diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2010-04-02 18:46:30 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-04-20 03:53:52 -0400 |
commit | 1ca5d2f0196cfca678086fa6f88eec4f9d0307ee (patch) | |
tree | 2d867897b6c6c88e912b60ca98ff06aaf98f1642 /drivers/mtd/maps/physmap.c | |
parent | fed457a83611182f5a2e049cce02f8f4e1b65644 (diff) |
mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
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>
Diffstat (limited to 'drivers/mtd/maps/physmap.c')
-rw-r--r-- | drivers/mtd/maps/physmap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index d9603f7f9652..426461a5f0d4 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -264,8 +264,11 @@ static int __init physmap_init(void) | |||
264 | 264 | ||
265 | err = platform_driver_register(&physmap_flash_driver); | 265 | err = platform_driver_register(&physmap_flash_driver); |
266 | #ifdef CONFIG_MTD_PHYSMAP_COMPAT | 266 | #ifdef CONFIG_MTD_PHYSMAP_COMPAT |
267 | if (err == 0) | 267 | if (err == 0) { |
268 | platform_device_register(&physmap_flash); | 268 | err = platform_device_register(&physmap_flash); |
269 | if (err) | ||
270 | platform_driver_unregister(&physmap_flash_driver); | ||
271 | } | ||
269 | #endif | 272 | #endif |
270 | 273 | ||
271 | return err; | 274 | return err; |