Skip to content

Commit

Permalink
ALSA: cs4231: Fix -Wformat-truncation warning for longname string
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tiwai committed Sep 15, 2023
1 parent 60a9c7f commit ba8bb7d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sound/isa/cs423x/cs4231.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ static int snd_cs4231_probe(struct device *dev, unsigned int n)
strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname));

if (dma2[n] < 0)
snprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %d, dma %d",
chip->pcm->name, chip->port, irq[n], dma1[n]);
scnprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %d, dma %d",
chip->pcm->name, chip->port, irq[n], dma1[n]);
else
snprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %d, dma %d&%d",
chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]);
scnprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %d, dma %d&%d",
chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]);

error = snd_wss_mixer(chip);
if (error < 0)
Expand Down

0 comments on commit ba8bb7d

Please sign in to comment.