linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Improve local variable data type in snd_hda_get_num_devices()
@ 2025-08-13 10:34 Thorsten Blum
  2025-08-13 15:45 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-08-13 10:34 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Julia Lawall, Thorsten Blum,
	Dr. David Alan Gilbert, Wentao Liang
  Cc: Takashi Iwai, linux-sound, linux-kernel

Use 'int' instead of 'unsigned int' because the local variable 'parm'
can be negative.

While an unsigned integer is harmless in practice due to the implicit
type conversion, it's safer and more idiomatic to use a signed integer
to properly check for -1.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 sound/hda/common/codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/hda/common/codec.c b/sound/hda/common/codec.c
index eb268d442201..cab479111603 100644
--- a/sound/hda/common/codec.c
+++ b/sound/hda/common/codec.c
@@ -300,7 +300,7 @@ EXPORT_SYMBOL_GPL(snd_hda_get_conn_index);
 unsigned int snd_hda_get_num_devices(struct hda_codec *codec, hda_nid_t nid)
 {
 	unsigned int wcaps = get_wcaps(codec, nid);
-	unsigned int parm;
+	int parm;
 
 	if (!codec->dp_mst || !(wcaps & AC_WCAP_DIGITAL) ||
 	    get_wcaps_type(wcaps) != AC_WID_PIN)
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: hda: Improve local variable data type in snd_hda_get_num_devices()
  2025-08-13 10:34 [PATCH] ALSA: hda: Improve local variable data type in snd_hda_get_num_devices() Thorsten Blum
@ 2025-08-13 15:45 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2025-08-13 15:45 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Jaroslav Kysela, Takashi Iwai, Julia Lawall,
	Dr. David Alan Gilbert, Wentao Liang, Takashi Iwai, linux-sound,
	linux-kernel

On Wed, 13 Aug 2025 12:34:16 +0200,
Thorsten Blum wrote:
> 
> Use 'int' instead of 'unsigned int' because the local variable 'parm'
> can be negative.
> 
> While an unsigned integer is harmless in practice due to the implicit
> type conversion, it's safer and more idiomatic to use a signed integer
> to properly check for -1.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-13 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 10:34 [PATCH] ALSA: hda: Improve local variable data type in snd_hda_get_num_devices() Thorsten Blum
2025-08-13 15:45 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).