提交 e32ec15a 编写于 作者: C Cyril Bur 提交者: Michael Ellerman

mtd: powernv_flash: Remove pointless goto in driver init

powernv_flash_probe() has pointless goto statements which jump to the
end of the function to simply return a variable. Rather than checking
for error and going to the label, just return the error as soon as it is
detected.
Signed-off-by: NCyril Bur <cyrilbur@gmail.com>
Acked-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 25ee52e6
...@@ -227,21 +227,20 @@ static int powernv_flash_probe(struct platform_device *pdev) ...@@ -227,21 +227,20 @@ static int powernv_flash_probe(struct platform_device *pdev)
int ret; int ret;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data) { if (!data)
ret = -ENOMEM; return -ENOMEM;
goto out;
}
data->mtd.priv = data; data->mtd.priv = data;
ret = of_property_read_u32(dev->of_node, "ibm,opal-id", &(data->id)); ret = of_property_read_u32(dev->of_node, "ibm,opal-id", &(data->id));
if (ret) { if (ret) {
dev_err(dev, "no device property 'ibm,opal-id'\n"); dev_err(dev, "no device property 'ibm,opal-id'\n");
goto out; return ret;
} }
ret = powernv_flash_set_driver_info(dev, &data->mtd); ret = powernv_flash_set_driver_info(dev, &data->mtd);
if (ret) if (ret)
goto out; return ret;
dev_set_drvdata(dev, data); dev_set_drvdata(dev, data);
...@@ -250,10 +249,7 @@ static int powernv_flash_probe(struct platform_device *pdev) ...@@ -250,10 +249,7 @@ static int powernv_flash_probe(struct platform_device *pdev)
* with an ffs partition at the start, it should prove easier for users * with an ffs partition at the start, it should prove easier for users
* to deal with partitions or not as they see fit * to deal with partitions or not as they see fit
*/ */
ret = mtd_device_register(&data->mtd, NULL, 0); return mtd_device_register(&data->mtd, NULL, 0);
out:
return ret;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册