]> Pileus Git - ~andy/linux/commitdiff
mtd: plat_nand: remove redundant return value check of platform_get_resource()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Tue, 7 Jan 2014 13:38:12 +0000 (21:38 +0800)
committerBrian Norris <computersforpeace@gmail.com>
Mon, 20 Jan 2014 19:37:29 +0000 (11:37 -0800)
Remove unneeded error handling on the result of a call
to platform_get_resource() when the value is passed to
devm_ioremap_resource(). And move those two call together
to make the connection between them more clear.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/plat_nand.c

index 4ebed7273bc00bf65acd936cacbfb3ceaf62cb56..0b068a5c0bff3c05aa2eba8e1ae93a01f6b8db98 100644 (file)
@@ -48,16 +48,13 @@ static int plat_nand_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res)
-               return -ENXIO;
-
        /* Allocate memory for the device structure (and zero it) */
        data = devm_kzalloc(&pdev->dev, sizeof(struct plat_nand_data),
                            GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        data->io_base = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(data->io_base))
                return PTR_ERR(data->io_base);