diff mbox

[1/3] ARM: OMAP2+: return -ENODEV if GPMC child device creation fails

Message ID 1363273762-17441-2-git-send-email-javier.martinez@collabora.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Javier Martinez Canillas March 14, 2013, 3:09 p.m. UTC
gpmc_probe_nor_child() calls of_platform_device_create() to create a
platform device for the NOR child. If this function fails the value
of ret is returned to the caller but this value is zero since it was
assigned the return of a previous call to gpmc_cs_program_settings()
that had to succeed or otherwise gpmc_probe_nor_child() would have
returned before.

This means that if of_platform_device_create() fails, 0 will be returned
to the caller instead of an appropriate error code.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 arch/arm/mach-omap2/gpmc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Hunter, Jon March 14, 2013, 6:50 p.m. UTC | #1
On 03/14/2013 10:09 AM, Javier Martinez Canillas wrote:
> gpmc_probe_nor_child() calls of_platform_device_create() to create a
> platform device for the NOR child. If this function fails the value
> of ret is returned to the caller but this value is zero since it was
> assigned the return of a previous call to gpmc_cs_program_settings()
> that had to succeed or otherwise gpmc_probe_nor_child() would have
> returned before.
> 
> This means that if of_platform_device_create() fails, 0 will be returned
> to the caller instead of an appropriate error code.
> 
> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> ---
>  arch/arm/mach-omap2/gpmc.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index d594e1d..8799aed 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -1505,6 +1505,7 @@ static int gpmc_probe_nor_child(struct platform_device *pdev,
>  		return 0;
>  
>  	dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name);
> +	ret = -ENODEV;
>  
>  err:
>  	gpmc_cs_free(cs);

Good catch! Thanks for the fix, I will pick this up.

Cheers
Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index d594e1d..8799aed 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1505,6 +1505,7 @@  static int gpmc_probe_nor_child(struct platform_device *pdev,
 		return 0;
 
 	dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name);
+	ret = -ENODEV;
 
 err:
 	gpmc_cs_free(cs);