]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
authorH Hartley Sweeten <hartleys@visionengravers.com>
Fri, 2 Apr 2010 22:46:30 +0000 (17:46 -0500)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 20 Apr 2010 07:53:52 +0000 (08:53 +0100)
If the default Kconfig values are used with MTD_PHYSMAP_COMPAT you end
up with a resource where end < start.  This causes __request_resource to
return a conflict which then returns an -EBUSY error code.  The current
physmap.c code just assumes that the platfom_device_register will always
succeed.

Catch this failure during the physmap_init and propogate the error.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/maps/physmap.c

index d9603f7f96522e66fdb6647a77f323371d2af9ed..426461a5f0d43cbebd076e5e07f3d2e0d656c891 100644 (file)
@@ -264,8 +264,11 @@ static int __init physmap_init(void)
 
        err = platform_driver_register(&physmap_flash_driver);
 #ifdef CONFIG_MTD_PHYSMAP_COMPAT
-       if (err == 0)
-               platform_device_register(&physmap_flash);
+       if (err == 0) {
+               err = platform_device_register(&physmap_flash);
+               if (err)
+                       platform_driver_unregister(&physmap_flash_driver);
+       }
 #endif
 
        return err;