Skip to content

Commit 1ca5d2f

Browse files
H Hartley SweetenDavid Woodhouse
authored andcommitted
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>
1 parent fed457a commit 1ca5d2f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎drivers/mtd/maps/physmap.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,11 @@ static int __init physmap_init(void)
264264

265265
err = platform_driver_register(&physmap_flash_driver);
266266
#ifdef CONFIG_MTD_PHYSMAP_COMPAT
267-
if (err == 0)
268-
platform_device_register(&physmap_flash);
267+
if (err == 0) {
268+
err = platform_device_register(&physmap_flash);
269+
if (err)
270+
platform_driver_unregister(&physmap_flash_driver);
271+
}
269272
#endif
270273

271274
return err;

0 commit comments

Comments
 (0)