Commit 840f53c3 authored by Wei Yongjun's avatar Wei Yongjun Committed by Brian Norris

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 4968a412
...@@ -48,16 +48,13 @@ static int plat_nand_probe(struct platform_device *pdev) ...@@ -48,16 +48,13 @@ static int plat_nand_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENXIO;
/* Allocate memory for the device structure (and zero it) */ /* Allocate memory for the device structure (and zero it) */
data = devm_kzalloc(&pdev->dev, sizeof(struct plat_nand_data), data = devm_kzalloc(&pdev->dev, sizeof(struct plat_nand_data),
GFP_KERNEL); GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
data->io_base = devm_ioremap_resource(&pdev->dev, res); data->io_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(data->io_base)) if (IS_ERR(data->io_base))
return PTR_ERR(data->io_base); return PTR_ERR(data->io_base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment