Skip to content

Commit

Permalink
ALSA: riptide: 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/20230915091313.5988-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Sep 15, 2023
1 parent ba8bb7d commit 322e0c5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sound/pci/riptide/riptide.c
Original file line number Diff line number Diff line change
Expand Up @@ -2105,15 +2105,15 @@ __snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
strcpy(card->driver, "RIPTIDE");
strcpy(card->shortname, "Riptide");
#ifdef SUPPORT_JOYSTICK
snprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x gameport 0x%x",
card->shortname, chip->port, chip->irq, chip->mpuaddr,
chip->opladdr, chip->gameaddr);
scnprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x gameport 0x%x",
card->shortname, chip->port, chip->irq, chip->mpuaddr,
chip->opladdr, chip->gameaddr);
#else
snprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x",
card->shortname, chip->port, chip->irq, chip->mpuaddr,
chip->opladdr);
scnprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x",
card->shortname, chip->port, chip->irq, chip->mpuaddr,
chip->opladdr);
#endif
snd_riptide_proc_init(chip);
err = snd_card_register(card);
Expand Down

0 comments on commit 322e0c5

Please sign in to comment.