ALSA: es1688: Fix -Wformat-truncation warning
authorTakashi Iwai <tiwai@suse.de>
Fri, 15 Sep 2023 08:27:56 +0000 (10:27 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 15 Sep 2023 11:21:33 +0000 (13:21 +0200)
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/20230915082802.28684-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/isa/es1688/es1688.c

index f935b56..97728bf 100644 (file)
@@ -130,9 +130,9 @@ static int snd_es1688_probe(struct snd_card *card, unsigned int n)
 
        strscpy(card->driver, "ES1688", sizeof(card->driver));
        strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
-       snprintf(card->longname, sizeof(card->longname),
-               "%s at 0x%lx, irq %i, dma %i", chip->pcm->name, chip->port,
-                chip->irq, chip->dma8);
+       scnprintf(card->longname, sizeof(card->longname),
+                 "%s at 0x%lx, irq %i, dma %i", chip->pcm->name, chip->port,
+                 chip->irq, chip->dma8);
 
        if (fm_port[n] == SNDRV_AUTO_PORT)
                fm_port[n] = port[n];   /* share the same port */