Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6.git] / drivers / macintosh / via-pmu.c
index 80b89649e676a197fe941371f3fa64e5040d7a4a..4f04fd0956a006a5bb9097cc558912b2df77f4df 100644 (file)
@@ -336,8 +336,10 @@ int __init find_via_pmu(void)
                        if (gaddr != OF_BAD_ADDR)
                                gpio_reg = ioremap(gaddr, 0x10);
                }
-               if (gpio_reg == NULL)
+               if (gpio_reg == NULL) {
                        printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n");
+                       goto fail_gpio;
+               }
        } else
                pmu_kind = PMU_UNKNOWN;
 
@@ -365,6 +367,9 @@ int __init find_via_pmu(void)
        return 1;
  fail:
        of_node_put(vias);
+       iounmap(gpio_reg);
+       gpio_reg = NULL;
+ fail_gpio:
        vias = NULL;
        return 0;
 }