Skip to content

Commit ea77850

Browse files
committed
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/[email protected] Reviewed-by: Takashi Sakamoto <[email protected]> Tested-by: Takashi Sakamoto <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 641e969 commit ea77850

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

sound/firewire/bebob/bebob_midi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ static void set_midi_substream_names(struct snd_bebob *bebob,
8484
struct snd_rawmidi_substream *subs;
8585

8686
list_for_each_entry(subs, &str->substreams, list) {
87-
snprintf(subs->name, sizeof(subs->name),
88-
"%s MIDI %d",
89-
bebob->card->shortname, subs->number + 1);
87+
scnprintf(subs->name, sizeof(subs->name),
88+
"%s MIDI %d",
89+
bebob->card->shortname, subs->number + 1);
9090
}
9191
}
9292

sound/firewire/dice/dice-midi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ static void set_midi_substream_names(struct snd_dice *dice,
8888
struct snd_rawmidi_substream *subs;
8989

9090
list_for_each_entry(subs, &str->substreams, list) {
91-
snprintf(subs->name, sizeof(subs->name),
92-
"%s MIDI %d", dice->card->shortname, subs->number + 1);
91+
scnprintf(subs->name, sizeof(subs->name),
92+
"%s MIDI %d", dice->card->shortname, subs->number + 1);
9393
}
9494
}
9595

sound/firewire/digi00x/digi00x-midi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ static void set_substream_names(struct snd_dg00x *dg00x,
100100

101101
list_for_each_entry(subs, &str->substreams, list) {
102102
if (!is_console) {
103-
snprintf(subs->name, sizeof(subs->name),
104-
"%s MIDI %d",
105-
dg00x->card->shortname,
106-
subs->number + 1);
103+
scnprintf(subs->name, sizeof(subs->name),
104+
"%s MIDI %d",
105+
dg00x->card->shortname,
106+
subs->number + 1);
107107
} else {
108-
snprintf(subs->name, sizeof(subs->name),
109-
"%s control",
110-
dg00x->card->shortname);
108+
scnprintf(subs->name, sizeof(subs->name),
109+
"%s control",
110+
dg00x->card->shortname);
111111
}
112112
}
113113
}

sound/firewire/fireface/ff-midi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ static void set_midi_substream_names(struct snd_rawmidi_str *stream,
7979
struct snd_rawmidi_substream *substream;
8080

8181
list_for_each_entry(substream, &stream->substreams, list) {
82-
snprintf(substream->name, sizeof(substream->name),
83-
"%s MIDI %d", name, substream->number + 1);
82+
scnprintf(substream->name, sizeof(substream->name),
83+
"%s MIDI %d", name, substream->number + 1);
8484
}
8585
}
8686

sound/firewire/fireworks/fireworks_midi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ static void set_midi_substream_names(struct snd_efw *efw,
8484
struct snd_rawmidi_substream *subs;
8585

8686
list_for_each_entry(subs, &str->substreams, list) {
87-
snprintf(subs->name, sizeof(subs->name),
88-
"%s MIDI %d", efw->card->shortname, subs->number + 1);
87+
scnprintf(subs->name, sizeof(subs->name),
88+
"%s MIDI %d", efw->card->shortname, subs->number + 1);
8989
}
9090
}
9191

sound/firewire/motu/motu-midi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ static void set_midi_substream_names(struct snd_motu *motu,
8888
struct snd_rawmidi_substream *subs;
8989

9090
list_for_each_entry(subs, &str->substreams, list) {
91-
snprintf(subs->name, sizeof(subs->name),
92-
"%s MIDI %d", motu->card->shortname, subs->number + 1);
91+
scnprintf(subs->name, sizeof(subs->name),
92+
"%s MIDI %d", motu->card->shortname, subs->number + 1);
9393
}
9494
}
9595

sound/firewire/oxfw/oxfw-midi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ static void set_midi_substream_names(struct snd_oxfw *oxfw,
129129
struct snd_rawmidi_substream *subs;
130130

131131
list_for_each_entry(subs, &str->substreams, list) {
132-
snprintf(subs->name, sizeof(subs->name),
133-
"%s MIDI %d",
134-
oxfw->card->shortname, subs->number + 1);
132+
scnprintf(subs->name, sizeof(subs->name),
133+
"%s MIDI %d",
134+
oxfw->card->shortname, subs->number + 1);
135135
}
136136
}
137137

sound/firewire/tascam/tascam-midi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ int snd_tscm_create_midi_devices(struct snd_tscm *tscm)
108108
/* TODO: support virtual MIDI ports. */
109109
if (subs->number < tscm->spec->midi_capture_ports) {
110110
/* Hardware MIDI ports. */
111-
snprintf(subs->name, sizeof(subs->name),
112-
"%s MIDI %d",
113-
tscm->card->shortname, subs->number + 1);
111+
scnprintf(subs->name, sizeof(subs->name),
112+
"%s MIDI %d",
113+
tscm->card->shortname, subs->number + 1);
114114
}
115115
}
116116

@@ -123,9 +123,9 @@ int snd_tscm_create_midi_devices(struct snd_tscm *tscm)
123123
list_for_each_entry(subs, &stream->substreams, list) {
124124
if (subs->number < tscm->spec->midi_playback_ports) {
125125
/* Hardware MIDI ports only. */
126-
snprintf(subs->name, sizeof(subs->name),
127-
"%s MIDI %d",
128-
tscm->card->shortname, subs->number + 1);
126+
scnprintf(subs->name, sizeof(subs->name),
127+
"%s MIDI %d",
128+
tscm->card->shortname, subs->number + 1);
129129
}
130130
}
131131

0 commit comments

Comments
 (0)