* [PATCH] ALSA: cmipci: Modify the incorrect format specifier
@ 2024-12-06 2:16 liujing
2024-12-06 12:52 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: liujing @ 2024-12-06 2:16 UTC (permalink / raw)
To: perex, tiwai, drhodes, jbrunet, broonie
Cc: linux-sound, linux-kernel, liujing
Replace %d with %u in snprintf() because it is "unsigned int".
Signed-off-by: liujing <liujing@cmss.chinamobile.com>
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index e3cac73517d6..cb8593c376ee 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -3084,7 +3084,7 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
}
}
}
- sprintf(card->shortname, "C-Media CMI%d", val);
+ sprintf(card->shortname, "C-Media CMI%u", val);
if (cm->chip_version < 68)
scnprintf(modelstr, sizeof(modelstr),
" (model %d)", cm->chip_version);
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: cmipci: Modify the incorrect format specifier
2024-12-06 2:16 [PATCH] ALSA: cmipci: Modify the incorrect format specifier liujing
@ 2024-12-06 12:52 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2024-12-06 12:52 UTC (permalink / raw)
To: liujing; +Cc: perex, tiwai, drhodes, jbrunet, broonie, linux-sound,
linux-kernel
On Fri, 06 Dec 2024 03:16:47 +0100,
liujing wrote:
>
> Replace %d with %u in snprintf() because it is "unsigned int".
>
> Signed-off-by: liujing <liujing@cmss.chinamobile.com>
I applied this one, but please keep in mind that we don't have to
convert all those cases blindly. The code there is correct even with
"%d", as the value can't be a negative value.
That said, if you keep working on a similar case, you'd better study
the code more closely and judge whether it really "fixes" any real
bug or not, before submitting patches at the next time.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-06 12:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 2:16 [PATCH] ALSA: cmipci: Modify the incorrect format specifier liujing
2024-12-06 12:52 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.