]> nv-tegra.nvidia Code Review - linux-3.10.git/commitdiff
[PATCH] ppc32: Fix string comparing in platform_notify_map
authorVitaly Bordug <vbordug@ru.mvista.com>
Mon, 3 Apr 2006 11:26:32 +0000 (15:26 +0400)
committerPaul Mackerras <paulus@samba.org>
Thu, 13 Apr 2006 16:30:19 +0000 (09:30 -0700)
Fixed odd function behavior when dev->bus_id does not contain '.' - it
compared that case 0 characters of the string and hereby reported success and
executed callback. Now bus_id's are compared correctly, extra callback
triggering eliminated.

Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/ppc/syslib/ppc_sys.c

index 60c724e1158499e6c136542447c96f9a13ddce96..7662c4e6e7d6070786ce144cb97ea20e6d4bd3a9 100644 (file)
@@ -156,12 +156,13 @@ void platform_notify_map(const struct platform_notify_dev_map *map,
        while (map->bus_id != NULL) {
                idx = -1;
                s = strrchr(dev->bus_id, '.');
-               if (s != NULL)
+               if (s != NULL) {
                        idx = (int)simple_strtol(s + 1, NULL, 10);
-               else
+                       len = s - dev->bus_id;
+               } else {
                        s = dev->bus_id;
-
-               len = s - dev->bus_id;
+                       len = strlen(dev->bus_id);
+               }
 
                if (!strncmp(dev->bus_id, map->bus_id, len)) {
                        pdev = container_of(dev, struct platform_device, dev);