Skip to content

Commit

Permalink
mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
H Hartley Sweeten authored and David Woodhouse committed Apr 20, 2010
1 parent fed457a commit 1ca5d2f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/mtd/maps/physmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1ca5d2f

Please sign in to comment.