ALSA: hda - Fix gcc compile warning
authorTakashi Iwai <tiwai@suse.de>
Tue, 3 Mar 2009 14:00:35 +0000 (15:00 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 3 Mar 2009 14:00:35 +0000 (15:00 +0100)
It's false positive, but annoying.
  sound/pci/hda/hda_codec.c: In function ‘get_empty_pcm_device’:
  sound/pci/hda/hda_codec.c:2772: warning: ‘dev’ may be used uninitialized in this function

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c

index 7c9ef5c18e771259e78681fd86c80938efacbd15..04cb1251e3e7baaf2d52f43c7fbcde770e23ce17 100644 (file)
@@ -2776,13 +2776,10 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type)
                for (i = 0; i < ARRAY_SIZE(audio_idx); i++) {
                        dev = audio_idx[i];
                        if (!test_bit(dev, bus->pcm_dev_bits))
-                               break;
-               }
-               if (i >= ARRAY_SIZE(audio_idx)) {
-                       snd_printk(KERN_WARNING "Too many audio devices\n");
-                       return -EAGAIN;
+                               goto ok;
                }
-               break;
+               snd_printk(KERN_WARNING "Too many audio devices\n");
+               return -EAGAIN;
        case HDA_PCM_TYPE_SPDIF:
        case HDA_PCM_TYPE_HDMI:
        case HDA_PCM_TYPE_MODEM:
@@ -2797,6 +2794,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type)
                snd_printk(KERN_WARNING "Invalid PCM type %d\n", type);
                return -EINVAL;
        }
+ ok:
        set_bit(dev, bus->pcm_dev_bits);
        return dev;
 }