diff mbox series

[v4,03/10] mtd: powernv_flash: Remove pointless goto in driver init

Message ID 20171010033302.20854-4-cyrilbur@gmail.com
State Superseded
Headers show
Series Allow opal-async waiters to get interrupted | expand

Commit Message

Cyril Bur Oct. 10, 2017, 3:32 a.m. UTC
Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
---
 drivers/mtd/devices/powernv_flash.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

Comments

Boris Brezillon Oct. 30, 2017, 8:51 a.m. UTC | #1
On Tue, 10 Oct 2017 14:32:55 +1100
Cyril Bur <cyrilbur@gmail.com> wrote:

Can you please add a short description here?

Once done you can add

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
> ---
>  drivers/mtd/devices/powernv_flash.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
> index ca3ca6adf71e..4dd3b5d2feb2 100644
> --- a/drivers/mtd/devices/powernv_flash.c
> +++ b/drivers/mtd/devices/powernv_flash.c
> @@ -227,21 +227,20 @@ static int powernv_flash_probe(struct platform_device *pdev)
>  	int ret;
>  
>  	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> -	if (!data) {
> -		ret = -ENOMEM;
> -		goto out;
> -	}
> +	if (!data)
> +		return -ENOMEM;
> +
>  	data->mtd.priv = data;
>  
>  	ret = of_property_read_u32(dev->of_node, "ibm,opal-id", &(data->id));
>  	if (ret) {
>  		dev_err(dev, "no device property 'ibm,opal-id'\n");
> -		goto out;
> +		return ret;
>  	}
>  
>  	ret = powernv_flash_set_driver_info(dev, &data->mtd);
>  	if (ret)
> -		goto out;
> +		return ret;
>  
>  	dev_set_drvdata(dev, data);
>  
> @@ -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
>  	 * to deal with partitions or not as they see fit
>  	 */
> -	ret = mtd_device_register(&data->mtd, NULL, 0);
> -
> -out:
> -	return ret;
> +	return mtd_device_register(&data->mtd, NULL, 0);
>  }
>  
>  /**
diff mbox series

Patch

diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
index ca3ca6adf71e..4dd3b5d2feb2 100644
--- a/drivers/mtd/devices/powernv_flash.c
+++ b/drivers/mtd/devices/powernv_flash.c
@@ -227,21 +227,20 @@  static int powernv_flash_probe(struct platform_device *pdev)
 	int ret;
 
 	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
-	if (!data) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!data)
+		return -ENOMEM;
+
 	data->mtd.priv = data;
 
 	ret = of_property_read_u32(dev->of_node, "ibm,opal-id", &(data->id));
 	if (ret) {
 		dev_err(dev, "no device property 'ibm,opal-id'\n");
-		goto out;
+		return ret;
 	}
 
 	ret = powernv_flash_set_driver_info(dev, &data->mtd);
 	if (ret)
-		goto out;
+		return ret;
 
 	dev_set_drvdata(dev, data);
 
@@ -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
 	 * to deal with partitions or not as they see fit
 	 */
-	ret = mtd_device_register(&data->mtd, NULL, 0);
-
-out:
-	return ret;
+	return mtd_device_register(&data->mtd, NULL, 0);
 }
 
 /**