Skip to content

Commit 3787ffd

Browse files
committed
ALSA: scarlett2: Fix yet more -Wformat-truncation warnings
The recent code change introduced a few false-positive compile warnings with -Wformat-trucation again. Suppress them by replacing snprintf() with scnprintf(). Fixes: 0a995e3 ("ALSA: scarlett2: Add support for software-controllable input gain") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 454abb8 commit 3787ffd

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

sound/usb/mixer_scarlett2.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5361,9 +5361,9 @@ static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer)
53615361
if (private->vol_sw_hw_switch[index])
53625362
scarlett2_vol_ctl_set_writable(mixer, i, 0);
53635363

5364-
snprintf(s, sizeof(s),
5365-
"Line Out %02d Volume Control Playback Enum",
5366-
i + 1);
5364+
scnprintf(s, sizeof(s),
5365+
"Line Out %02d Volume Control Playback Enum",
5366+
i + 1);
53675367
err = scarlett2_add_new_ctl(mixer,
53685368
&scarlett2_sw_hw_enum_ctl,
53695369
i, 1, s,
@@ -5406,8 +5406,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
54065406

54075407
/* Add input level (line/inst) controls */
54085408
for (i = 0; i < info->level_input_count; i++) {
5409-
snprintf(s, sizeof(s), fmt, i + 1 + info->level_input_first,
5410-
"Level", "Enum");
5409+
scnprintf(s, sizeof(s), fmt, i + 1 + info->level_input_first,
5410+
"Level", "Enum");
54115411
err = scarlett2_add_new_ctl(mixer, &scarlett2_level_enum_ctl,
54125412
i, 1, s, &private->level_ctls[i]);
54135413
if (err < 0)
@@ -5416,7 +5416,7 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
54165416

54175417
/* Add input pad controls */
54185418
for (i = 0; i < info->pad_input_count; i++) {
5419-
snprintf(s, sizeof(s), fmt, i + 1, "Pad", "Switch");
5419+
scnprintf(s, sizeof(s), fmt, i + 1, "Pad", "Switch");
54205420
err = scarlett2_add_new_ctl(mixer, &scarlett2_pad_ctl,
54215421
i, 1, s, &private->pad_ctls[i]);
54225422
if (err < 0)
@@ -5425,8 +5425,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
54255425

54265426
/* Add input air controls */
54275427
for (i = 0; i < info->air_input_count; i++) {
5428-
snprintf(s, sizeof(s), fmt, i + 1 + info->air_input_first,
5429-
"Air", info->air_option ? "Enum" : "Switch");
5428+
scnprintf(s, sizeof(s), fmt, i + 1 + info->air_input_first,
5429+
"Air", info->air_option ? "Enum" : "Switch");
54305430
err = scarlett2_add_new_ctl(
54315431
mixer, &scarlett2_air_ctl[info->air_option],
54325432
i, 1, s, &private->air_ctls[i]);
@@ -5481,9 +5481,9 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
54815481

54825482
for (i = 0; i < info->gain_input_count; i++) {
54835483
if (i % 2) {
5484-
snprintf(s, sizeof(s),
5485-
"Line In %d-%d Link Capture Switch",
5486-
i, i + 1);
5484+
scnprintf(s, sizeof(s),
5485+
"Line In %d-%d Link Capture Switch",
5486+
i, i + 1);
54875487
err = scarlett2_add_new_ctl(
54885488
mixer, &scarlett2_input_link_ctl,
54895489
i / 2, 1, s,
@@ -5492,30 +5492,30 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
54925492
return err;
54935493
}
54945494

5495-
snprintf(s, sizeof(s), fmt, i + 1,
5496-
"Gain", "Volume");
5495+
scnprintf(s, sizeof(s), fmt, i + 1,
5496+
"Gain", "Volume");
54975497
err = scarlett2_add_new_ctl(
54985498
mixer, &scarlett2_input_gain_ctl,
54995499
i, 1, s, &private->input_gain_ctls[i]);
55005500
if (err < 0)
55015501
return err;
55025502

5503-
snprintf(s, sizeof(s), fmt, i + 1,
5504-
"Autogain", "Switch");
5503+
scnprintf(s, sizeof(s), fmt, i + 1,
5504+
"Autogain", "Switch");
55055505
err = scarlett2_add_new_ctl(
55065506
mixer, &scarlett2_autogain_switch_ctl,
55075507
i, 1, s, &private->autogain_ctls[i]);
55085508
if (err < 0)
55095509
return err;
55105510

5511-
snprintf(s, sizeof(s), fmt, i + 1,
5512-
"Autogain Status", "Enum");
5511+
scnprintf(s, sizeof(s), fmt, i + 1,
5512+
"Autogain Status", "Enum");
55135513
err = scarlett2_add_new_ctl(
55145514
mixer, &scarlett2_autogain_status_ctl,
55155515
i, 1, s, &private->autogain_status_ctls[i]);
55165516

5517-
snprintf(s, sizeof(s), fmt, i + 1,
5518-
"Safe", "Switch");
5517+
scnprintf(s, sizeof(s), fmt, i + 1,
5518+
"Safe", "Switch");
55195519
err = scarlett2_add_new_ctl(
55205520
mixer, &scarlett2_safe_ctl,
55215521
i, 1, s, &private->safe_ctls[i]);
@@ -5902,8 +5902,8 @@ static int scarlett2_add_direct_monitor_ctls(struct usb_mixer_interface *mixer)
59025902
for (k = 0; k < private->num_mix_in; k++, index++) {
59035903
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
59045904

5905-
snprintf(name, sizeof(name), format,
5906-
mix_type, 'A' + j, k + 1);
5905+
scnprintf(name, sizeof(name), format,
5906+
mix_type, 'A' + j, k + 1);
59075907

59085908
err = scarlett2_add_new_ctl(
59095909
mixer, &scarlett2_monitor_mix_ctl,

0 commit comments

Comments
 (0)