Skip to content

Commit 60a9c7f

Browse files
committed
ALSA: ad1848: 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 5f6af00 commit 60a9c7f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sound/isa/ad1848/ad1848.c

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

9898
if (!thinkpad[n])
99-
snprintf(card->longname, sizeof(card->longname),
100-
"%s at 0x%lx, irq %d, dma %d",
101-
chip->pcm->name, chip->port, irq[n], dma1[n]);
99+
scnprintf(card->longname, sizeof(card->longname),
100+
"%s at 0x%lx, irq %d, dma %d",
101+
chip->pcm->name, chip->port, irq[n], dma1[n]);
102102
else
103-
snprintf(card->longname, sizeof(card->longname),
104-
"%s at 0x%lx, irq %d, dma %d [Thinkpad]",
105-
chip->pcm->name, chip->port, irq[n], dma1[n]);
103+
scnprintf(card->longname, sizeof(card->longname),
104+
"%s at 0x%lx, irq %d, dma %d [Thinkpad]",
105+
chip->pcm->name, chip->port, irq[n], dma1[n]);
106106

107107
error = snd_card_register(card);
108108
if (error < 0)

0 commit comments

Comments
 (0)