mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	lkml <linux-kernel@vger.kernel.org>,
	David Woodhouse <dwmw2@infradead.org>,
	"randy.dunlap@oracle.com" <randy.dunlap@oracle.com>
Subject: Re: [PATCH] mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
Date: Fri, 2 Apr 2010 18:09:37 -0700	[thread overview]
Message-ID: <20100402180937.6c4a455a.randy.dunlap@oracle.com> (raw)
In-Reply-To: <0D753D10438DA54287A00B0270842697636A7E9D36@AUSP01VMBX24.collaborationhost.net>

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

      reply	other threads:[~2010-04-03  1:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-02 22:46 H Hartley Sweeten
2010-04-03  1:09 ` Randy Dunlap [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100402180937.6c4a455a.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=dwmw2@infradead.org \
    --cc=hartleys@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®