Skip to content

Commit bc44e10

Browse files
committed
ALSA: opti9x: Fix -Wformat-truncation warning
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 1e97acf commit bc44e10

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

sound/isa/opti9xx/miro.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,10 +1344,10 @@ static int snd_miro_probe(struct snd_card *card)
13441344
}
13451345

13461346
strcpy(card->driver, "miro");
1347-
snprintf(card->longname, sizeof(card->longname),
1348-
"%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
1349-
card->shortname, miro->name, codec->pcm->name,
1350-
miro->wss_base + 4, miro->irq, miro->dma1, miro->dma2);
1347+
scnprintf(card->longname, sizeof(card->longname),
1348+
"%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
1349+
card->shortname, miro->name, codec->pcm->name,
1350+
miro->wss_base + 4, miro->irq, miro->dma1, miro->dma2);
13511351

13521352
if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)
13531353
rmidi = NULL;

sound/isa/opti9xx/opti92x-ad1848.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -859,15 +859,15 @@ static int snd_opti9xx_probe(struct snd_card *card)
859859
strcpy(card->driver, chip->name);
860860
sprintf(card->shortname, "OPTi %s", card->driver);
861861
#if defined(CS4231) || defined(OPTi93X)
862-
snprintf(card->longname, sizeof(card->longname),
863-
"%s, %s at 0x%lx, irq %d, dma %d&%d",
864-
card->shortname, codec->pcm->name,
865-
chip->wss_base + 4, irq, dma1, xdma2);
862+
scnprintf(card->longname, sizeof(card->longname),
863+
"%s, %s at 0x%lx, irq %d, dma %d&%d",
864+
card->shortname, codec->pcm->name,
865+
chip->wss_base + 4, irq, dma1, xdma2);
866866
#else
867-
snprintf(card->longname, sizeof(card->longname),
868-
"%s, %s at 0x%lx, irq %d, dma %d",
869-
card->shortname, codec->pcm->name, chip->wss_base + 4, irq,
870-
dma1);
867+
scnprintf(card->longname, sizeof(card->longname),
868+
"%s, %s at 0x%lx, irq %d, dma %d",
869+
card->shortname, codec->pcm->name, chip->wss_base + 4, irq,
870+
dma1);
871871
#endif /* CS4231 || OPTi93X */
872872

873873
if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)

0 commit comments

Comments
 (0)