]> www.infradead.org Git - users/hch/misc.git/commitdiff
ALSA: hda: Improve local variable data type in snd_hda_get_num_devices()
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 13 Aug 2025 10:34:16 +0000 (12:34 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 13 Aug 2025 15:44:45 +0000 (17:44 +0200)
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>
Link: https://patch.msgid.link/20250813103418.164110-2-thorsten.blum@linux.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/common/codec.c

index eb268d442201ad6722dd82e8f4552eefb0630e65..cab479111603dcdffb64a5251b162bcedb538af8 100644 (file)
@@ -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)