namehint: Another fix to properly evaluate hw devices
authorJaroslav Kysela <perex@perex.cz>
Fri, 1 Oct 2010 12:08:03 +0000 (14:08 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 1 Oct 2010 12:08:03 +0000 (14:08 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>

src/control/namehint.c

index ab3525e..faaa5d5 100644 (file)
@@ -439,11 +439,12 @@ static int add_card(struct hint_list *list, int card)
                        err = next_devices[list->iface](list->ctl, &device);
                        if (device < 0)
                                err = -EINVAL;
+                       else
+                               max_device = device;
                        while (err >= 0 && device >= 0) {
                                err = next_devices[list->iface](list->ctl, &device);
-                               if (device > max_device)
+                               if (err >= 0 && device > max_device)
                                        max_device = device;
-                               ok++;
                        }
                        ok = 0;
                        for (device = 0; err >= 0 && device <= max_device; device++) {