diff mbox series

[2/2] misc: xilinx_sdfec: Combine three condition checks into one statement in xsdfec_add_ldpc()

Message ID b927be91-a380-1bba-2b10-f0ca49c477b5@web.de (mailing list archive)
State New, archived
Headers show
Series misc: xilinx_sdfec: Adjustments for xsdfec_add_ldpc() | expand

Commit Message

Markus Elfring Nov. 5, 2019, 6:56 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 5 Nov 2019 19:32:25 +0100

The same return code was set after three condition checks.
Thus use a single statement instead.

Fixes: 20ec628e8007ec75c2f884e00004f39eab6289b5 ("misc: xilinx_sdfec: Add ability to configure LDPC")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/misc/xilinx_sdfec.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

--
2.24.0

Comments

Dragan Cvetic Nov. 7, 2019, 4:30 p.m. UTC | #1
Hi Markus,


> -----Original Message-----
> From: Markus Elfring [mailto:Markus.Elfring@web.de]
> Sent: Tuesday 5 November 2019 18:56
> To: linux-arm-kernel@lists.infradead.org; Arnd Bergmann <arnd@arndb.de>; Derek Kiernan <dkiernan@xilinx.com>; Dragan Cvetic
> <draganc@xilinx.com>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Michal Simek <michals@xilinx.com>
> Cc: LKML <linux-kernel@vger.kernel.org>; kernel-janitors@vger.kernel.org
> Subject: [PATCH 2/2] misc: xilinx_sdfec: Combine three condition checks into one statement in xsdfec_add_ldpc()
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 5 Nov 2019 19:32:25 +0100
> 
> The same return code was set after three condition checks.
> Thus use a single statement instead.
> 
> Fixes: 20ec628e8007ec75c2f884e00004f39eab6289b5 ("misc: xilinx_sdfec: Add ability to configure LDPC")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/misc/xilinx_sdfec.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
> index a622fcf4954a..322d5c6e6d12 100644
> --- a/drivers/misc/xilinx_sdfec.c
> +++ b/drivers/misc/xilinx_sdfec.c
> @@ -653,18 +653,10 @@ static int xsdfec_add_ldpc(struct xsdfec_dev *xsdfec, void __user *arg)
>  	if (IS_ERR(ldpc))
>  		return PTR_ERR(ldpc);
> 
> -	if (xsdfec->config.code == XSDFEC_TURBO_CODE) {
> -		ret = -EIO;
> -		goto err_out;
> -	}
> -
> -	/* Verify Device has not started */
> -	if (xsdfec->state == XSDFEC_STARTED) {
> -		ret = -EIO;
> -		goto err_out;
> -	}
> -
> -	if (xsdfec->config.code_wr_protect) {
> +	if (xsdfec->config.code == XSDFEC_TURBO_CODE ||
> +	    /* Verify device has not started */
> +	    xsdfec->state == XSDFEC_STARTED ||
> +	    xsdfec->config.code_wr_protect) {
>  		ret = -EIO;
>  		goto err_out;
>  	}

approved

> --
> 2.24.0
Dragan Cvetic Nov. 7, 2019, 9:58 p.m. UTC | #2
> -----Original Message-----
> From: Markus Elfring [mailto:Markus.Elfring@web.de]
> Sent: Tuesday 5 November 2019 18:56
> To: linux-arm-kernel@lists.infradead.org; Arnd Bergmann <arnd@arndb.de>; Derek Kiernan <dkiernan@xilinx.com>; Dragan Cvetic
> <draganc@xilinx.com>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Michal Simek <michals@xilinx.com>
> Cc: LKML <linux-kernel@vger.kernel.org>; kernel-janitors@vger.kernel.org
> Subject: [PATCH 2/2] misc: xilinx_sdfec: Combine three condition checks into one statement in xsdfec_add_ldpc()
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 5 Nov 2019 19:32:25 +0100
> 
> The same return code was set after three condition checks.
> Thus use a single statement instead.
> 
> Fixes: 20ec628e8007ec75c2f884e00004f39eab6289b5 ("misc: xilinx_sdfec: Add ability to configure LDPC")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/misc/xilinx_sdfec.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
> index a622fcf4954a..322d5c6e6d12 100644
> --- a/drivers/misc/xilinx_sdfec.c
> +++ b/drivers/misc/xilinx_sdfec.c
> @@ -653,18 +653,10 @@ static int xsdfec_add_ldpc(struct xsdfec_dev *xsdfec, void __user *arg)
>  	if (IS_ERR(ldpc))
>  		return PTR_ERR(ldpc);
> 
> -	if (xsdfec->config.code == XSDFEC_TURBO_CODE) {
> -		ret = -EIO;
> -		goto err_out;
> -	}
> -
> -	/* Verify Device has not started */
> -	if (xsdfec->state == XSDFEC_STARTED) {
> -		ret = -EIO;
> -		goto err_out;
> -	}
> -
> -	if (xsdfec->config.code_wr_protect) {
> +	if (xsdfec->config.code == XSDFEC_TURBO_CODE ||
> +	    /* Verify device has not started */
> +	    xsdfec->state == XSDFEC_STARTED ||
> +	    xsdfec->config.code_wr_protect) {
>  		ret = -EIO;
>  		goto err_out;
>  	}
> --
> 2.24.0

Acked-by: Dragan Cvetic <dragan.cvetic@xilinx.com>
diff mbox series

Patch

diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index a622fcf4954a..322d5c6e6d12 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -653,18 +653,10 @@  static int xsdfec_add_ldpc(struct xsdfec_dev *xsdfec, void __user *arg)
 	if (IS_ERR(ldpc))
 		return PTR_ERR(ldpc);

-	if (xsdfec->config.code == XSDFEC_TURBO_CODE) {
-		ret = -EIO;
-		goto err_out;
-	}
-
-	/* Verify Device has not started */
-	if (xsdfec->state == XSDFEC_STARTED) {
-		ret = -EIO;
-		goto err_out;
-	}
-
-	if (xsdfec->config.code_wr_protect) {
+	if (xsdfec->config.code == XSDFEC_TURBO_CODE ||
+	    /* Verify device has not started */
+	    xsdfec->state == XSDFEC_STARTED ||
+	    xsdfec->config.code_wr_protect) {
 		ret = -EIO;
 		goto err_out;
 	}