diff mbox series

[8/8] firmware: arm_scmi: simplify exit path by returning on error

Message ID 1525885634-22348-9-git-send-email-sudeep.holla@arm.com
State Accepted
Commit 632de8f542bcd44c756637da0e7d824e7129e496
Headers show
Series firmware: arm_scmi: trivial cleanups | expand

Commit Message

Sudeep Holla May 9, 2018, 5:07 p.m. UTC
Yet another nasty indentation left out during code restructuring. It's
must simpler to return on error instead of having unnecessary indentation.

Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

---
 drivers/firmware/arm_scmi/driver.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.7.4

Comments

Jonathan Cameron May 17, 2018, 9:14 a.m. UTC | #1
On Wed, 9 May 2018 18:07:14 +0100
Sudeep Holla <sudeep.holla@arm.com> wrote:

> Yet another nasty indentation left out during code restructuring. It's

> must simpler to return on error instead of having unnecessary indentation.

> 

> Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>



> ---

>  drivers/firmware/arm_scmi/driver.c | 11 ++++++-----

>  1 file changed, 6 insertions(+), 5 deletions(-)

> 

> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c

> index 4087d6c50ecd..e996395af5f2 100644

> --- a/drivers/firmware/arm_scmi/driver.c

> +++ b/drivers/firmware/arm_scmi/driver.c

> @@ -687,11 +687,12 @@ static int scmi_remove(struct platform_device *pdev)

>  		list_del(&info->node);

>  	mutex_unlock(&scmi_list_mutex);

>  

> -	if (!ret) {

> -		/* Safe to free channels since no more users */

> -		ret = idr_for_each(idr, scmi_mbox_free_channel, idr);

> -		idr_destroy(&info->tx_idr);

> -	}

> +	if (ret)

> +		return ret;

> +

> +	/* Safe to free channels since no more users */

> +	ret = idr_for_each(idr, scmi_mbox_free_channel, idr);

> +	idr_destroy(&info->tx_idr);

>  

>  	return ret;

>  }
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 4087d6c50ecd..e996395af5f2 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -687,11 +687,12 @@  static int scmi_remove(struct platform_device *pdev)
 		list_del(&info->node);
 	mutex_unlock(&scmi_list_mutex);
 
-	if (!ret) {
-		/* Safe to free channels since no more users */
-		ret = idr_for_each(idr, scmi_mbox_free_channel, idr);
-		idr_destroy(&info->tx_idr);
-	}
+	if (ret)
+		return ret;
+
+	/* Safe to free channels since no more users */
+	ret = idr_for_each(idr, scmi_mbox_free_channel, idr);
+	idr_destroy(&info->tx_idr);
 
 	return ret;
 }