From: Javier Martinez Canillas Date: Thu, 14 Mar 2013 15:09:20 +0000 (+0100) Subject: ARM: OMAP2+: return -ENODEV if GPMC child device creation fails X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e8ffd6fdf28ac8404acebf2759315600bfdcb5f9;p=linux-beck.git ARM: OMAP2+: return -ENODEV if GPMC child device creation fails 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 Signed-off-by: Jon Hunter Tested-by: Ezequiel Garcia --- diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 5f6af202807a..c6f0ef563817 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c @@ -1495,6 +1495,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);