mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
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/20230915091313.5988-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
5f6af0050a
commit
60a9c7f7fb
@ -96,13 +96,13 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n)
|
||||
strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
|
||||
|
||||
if (!thinkpad[n])
|
||||
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 [Thinkpad]",
|
||||
chip->pcm->name, chip->port, irq[n], dma1[n]);
|
||||
scnprintf(card->longname, sizeof(card->longname),
|
||||
"%s at 0x%lx, irq %d, dma %d [Thinkpad]",
|
||||
chip->pcm->name, chip->port, irq[n], dma1[n]);
|
||||
|
||||
error = snd_card_register(card);
|
||||
if (error < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user