[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20100402180937.6c4a455a.randy.dunlap@oracle.com>
Date: Fri, 2 Apr 2010 18:09:37 -0700
From: Randy Dunlap <randy.dunlap@...cle.com>
To: H Hartley Sweeten <hartleys@...ionengravers.com>
Cc: "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
lkml <linux-kernel@...r.kernel.org>,
David Woodhouse <dwmw2@...radead.org>,
"randy.dunlap@...cle.com" <randy.dunlap@...cle.com>
Subject: Re: [PATCH] mtd/maps/physmap: catch failure to register
MTD_PHYSMAP_COMPAT device
On Fri, 2 Apr 2010 17:46:30 -0500 H Hartley Sweeten wrote:
> 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@...ionengravers.com>
> Cc: David Woodhouse <dwmw2@...radead.org>
> Reported-by: Randy Dunlap <randy.dunlap@...cle.com>
Thanks, Hartley.
Tested-by: Randy Dunlap <randy.dunlap@...cle.com>
> ---
>
> diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
> index d9603f7..426461a 100644
> --- a/drivers/mtd/maps/physmap.c
> +++ b/drivers/mtd/maps/physmap.c
> @@ -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;
---
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists