Commit ea77850e authored by Takashi Iwai's avatar Takashi Iwai

ALSA: firewire: Fix -Wformat-truncation warning for MIDI stream names

The compile warnings at filling MIDI stream name strings are all
false-positive; the number of streams can't go so high.

For suppressing the warning, replace snprintf() with scnprintf().
As stated in the above, truncation doesn't matter.

Link: https://lore.kernel.org/r/20230915082802.28684-12-tiwai@suse.deReviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 641e9691
...@@ -84,9 +84,9 @@ static void set_midi_substream_names(struct snd_bebob *bebob, ...@@ -84,9 +84,9 @@ static void set_midi_substream_names(struct snd_bebob *bebob,
struct snd_rawmidi_substream *subs; struct snd_rawmidi_substream *subs;
list_for_each_entry(subs, &str->substreams, list) { list_for_each_entry(subs, &str->substreams, list) {
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s MIDI %d", "%s MIDI %d",
bebob->card->shortname, subs->number + 1); bebob->card->shortname, subs->number + 1);
} }
} }
......
...@@ -88,8 +88,8 @@ static void set_midi_substream_names(struct snd_dice *dice, ...@@ -88,8 +88,8 @@ static void set_midi_substream_names(struct snd_dice *dice,
struct snd_rawmidi_substream *subs; struct snd_rawmidi_substream *subs;
list_for_each_entry(subs, &str->substreams, list) { list_for_each_entry(subs, &str->substreams, list) {
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s MIDI %d", dice->card->shortname, subs->number + 1); "%s MIDI %d", dice->card->shortname, subs->number + 1);
} }
} }
......
...@@ -100,14 +100,14 @@ static void set_substream_names(struct snd_dg00x *dg00x, ...@@ -100,14 +100,14 @@ static void set_substream_names(struct snd_dg00x *dg00x,
list_for_each_entry(subs, &str->substreams, list) { list_for_each_entry(subs, &str->substreams, list) {
if (!is_console) { if (!is_console) {
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s MIDI %d", "%s MIDI %d",
dg00x->card->shortname, dg00x->card->shortname,
subs->number + 1); subs->number + 1);
} else { } else {
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s control", "%s control",
dg00x->card->shortname); dg00x->card->shortname);
} }
} }
} }
......
...@@ -79,8 +79,8 @@ static void set_midi_substream_names(struct snd_rawmidi_str *stream, ...@@ -79,8 +79,8 @@ static void set_midi_substream_names(struct snd_rawmidi_str *stream,
struct snd_rawmidi_substream *substream; struct snd_rawmidi_substream *substream;
list_for_each_entry(substream, &stream->substreams, list) { list_for_each_entry(substream, &stream->substreams, list) {
snprintf(substream->name, sizeof(substream->name), scnprintf(substream->name, sizeof(substream->name),
"%s MIDI %d", name, substream->number + 1); "%s MIDI %d", name, substream->number + 1);
} }
} }
......
...@@ -84,8 +84,8 @@ static void set_midi_substream_names(struct snd_efw *efw, ...@@ -84,8 +84,8 @@ static void set_midi_substream_names(struct snd_efw *efw,
struct snd_rawmidi_substream *subs; struct snd_rawmidi_substream *subs;
list_for_each_entry(subs, &str->substreams, list) { list_for_each_entry(subs, &str->substreams, list) {
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s MIDI %d", efw->card->shortname, subs->number + 1); "%s MIDI %d", efw->card->shortname, subs->number + 1);
} }
} }
......
...@@ -88,8 +88,8 @@ static void set_midi_substream_names(struct snd_motu *motu, ...@@ -88,8 +88,8 @@ static void set_midi_substream_names(struct snd_motu *motu,
struct snd_rawmidi_substream *subs; struct snd_rawmidi_substream *subs;
list_for_each_entry(subs, &str->substreams, list) { list_for_each_entry(subs, &str->substreams, list) {
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s MIDI %d", motu->card->shortname, subs->number + 1); "%s MIDI %d", motu->card->shortname, subs->number + 1);
} }
} }
......
...@@ -129,9 +129,9 @@ static void set_midi_substream_names(struct snd_oxfw *oxfw, ...@@ -129,9 +129,9 @@ static void set_midi_substream_names(struct snd_oxfw *oxfw,
struct snd_rawmidi_substream *subs; struct snd_rawmidi_substream *subs;
list_for_each_entry(subs, &str->substreams, list) { list_for_each_entry(subs, &str->substreams, list) {
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s MIDI %d", "%s MIDI %d",
oxfw->card->shortname, subs->number + 1); oxfw->card->shortname, subs->number + 1);
} }
} }
......
...@@ -108,9 +108,9 @@ int snd_tscm_create_midi_devices(struct snd_tscm *tscm) ...@@ -108,9 +108,9 @@ int snd_tscm_create_midi_devices(struct snd_tscm *tscm)
/* TODO: support virtual MIDI ports. */ /* TODO: support virtual MIDI ports. */
if (subs->number < tscm->spec->midi_capture_ports) { if (subs->number < tscm->spec->midi_capture_ports) {
/* Hardware MIDI ports. */ /* Hardware MIDI ports. */
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s MIDI %d", "%s MIDI %d",
tscm->card->shortname, subs->number + 1); tscm->card->shortname, subs->number + 1);
} }
} }
...@@ -123,9 +123,9 @@ int snd_tscm_create_midi_devices(struct snd_tscm *tscm) ...@@ -123,9 +123,9 @@ int snd_tscm_create_midi_devices(struct snd_tscm *tscm)
list_for_each_entry(subs, &stream->substreams, list) { list_for_each_entry(subs, &stream->substreams, list) {
if (subs->number < tscm->spec->midi_playback_ports) { if (subs->number < tscm->spec->midi_playback_ports) {
/* Hardware MIDI ports only. */ /* Hardware MIDI ports only. */
snprintf(subs->name, sizeof(subs->name), scnprintf(subs->name, sizeof(subs->name),
"%s MIDI %d", "%s MIDI %d",
tscm->card->shortname, subs->number + 1); tscm->card->shortname, subs->number + 1);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment