All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
@ 2010-04-02 22:46 ` H Hartley Sweeten
  0 siblings, 0 replies; 4+ messages in thread
From: H Hartley Sweeten @ 2010-04-02 22:46 UTC (permalink / raw)
  To: linux-mtd, lkml; +Cc: David Woodhouse, randy.dunlap

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1233 bytes --]

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>
Cc: David Woodhouse <dwmw2@infradead.org>
Reported-by: Randy Dunlap <randy.dunlap@oracle.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;
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
@ 2010-04-02 22:46 ` H Hartley Sweeten
  0 siblings, 0 replies; 4+ messages in thread
From: H Hartley Sweeten @ 2010-04-02 22:46 UTC (permalink / raw)
  To: linux-mtd, lkml; +Cc: randy.dunlap, David Woodhouse

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>
Cc: David Woodhouse <dwmw2@infradead.org>
Reported-by: Randy Dunlap <randy.dunlap@oracle.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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
  2010-04-02 22:46 ` H Hartley Sweeten
@ 2010-04-03  1:09   ` Randy Dunlap
  -1 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2010-04-03  1:09 UTC (permalink / raw)
  To: H Hartley Sweeten; +Cc: linux-mtd, lkml, David Woodhouse, randy.dunlap

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@visionengravers.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Reported-by: Randy Dunlap <randy.dunlap@oracle.com>

Thanks, Hartley.

Tested-by: Randy Dunlap <randy.dunlap@oracle.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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
@ 2010-04-03  1:09   ` Randy Dunlap
  0 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2010-04-03  1:09 UTC (permalink / raw)
  To: H Hartley Sweeten; +Cc: randy.dunlap, David Woodhouse, linux-mtd, lkml

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@visionengravers.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Reported-by: Randy Dunlap <randy.dunlap@oracle.com>

Thanks, Hartley.

Tested-by: Randy Dunlap <randy.dunlap@oracle.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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-03  1:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-02 22:46 [PATCH] mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device H Hartley Sweeten
2010-04-02 22:46 ` H Hartley Sweeten
2010-04-03  1:09 ` Randy Dunlap
2010-04-03  1:09   ` Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.