mtd: plat_nand: remove redundant return value check of platform_get_resource()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jan 28 00:59:07 EST 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=840f53c31224d687a7c4a24ea118fa3c737407b0
Commit:     840f53c31224d687a7c4a24ea118fa3c737407b0
Parent:     4968a4124cf2df4b3672eed4714c6755f10f400c
Author:     Wei Yongjun <yongjun_wei at trendmicro.com.cn>
AuthorDate: Tue Jan 7 21:38:12 2014 +0800
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Jan 20 11:37:29 2014 -0800

    mtd: plat_nand: remove redundant return value check of platform_get_resource()
    
    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 at trendmicro.com.cn>
    Reviewed-by: Jingoo Han <jg1.han at samsung.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/plat_nand.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index 4ebed72..0b068a5 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -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);



More information about the linux-mtd-cvs mailing list