Skip to content

Commit ba8bb7d

Browse files
committed
ALSA: cs4231: Fix -Wformat-truncation warning for longname string
The filling of card->longname can be gracefully truncated, as it's only informative. Use scnprintf() and suppress the superfluous compile warning with -Wformat-truncation. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 60a9c7f commit ba8bb7d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sound/isa/cs423x/cs4231.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ static int snd_cs4231_probe(struct device *dev, unsigned int n)
9898
strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
9999

100100
if (dma2[n] < 0)
101-
snprintf(card->longname, sizeof(card->longname),
102-
"%s at 0x%lx, irq %d, dma %d",
103-
chip->pcm->name, chip->port, irq[n], dma1[n]);
101+
scnprintf(card->longname, sizeof(card->longname),
102+
"%s at 0x%lx, irq %d, dma %d",
103+
chip->pcm->name, chip->port, irq[n], dma1[n]);
104104
else
105-
snprintf(card->longname, sizeof(card->longname),
106-
"%s at 0x%lx, irq %d, dma %d&%d",
107-
chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]);
105+
scnprintf(card->longname, sizeof(card->longname),
106+
"%s at 0x%lx, irq %d, dma %d&%d",
107+
chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]);
108108

109109
error = snd_wss_mixer(chip);
110110
if (error < 0)

0 commit comments

Comments
 (0)