mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: cqspi: remove redundant dead code on error return check
@ 2017-01-31 15:53 Colin King
  2017-01-31 16:39 ` Richard Weinberger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin King @ 2017-01-31 15:53 UTC (permalink / raw)
  To: Cyrille Pitchen, Marek Vasut, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger, linux-mtd
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Checking for ret < 0 is redundant because a previous check on ret
being non-zero already handles the ret < 0 case. Remove the redundant
code. Found by CoverityScan, CID#1398863, CID#1398864

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/mtd/spi-nor/cadence-quadspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index 3fb7be8..9f8102d 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -893,7 +893,7 @@ static ssize_t cqspi_write(struct spi_nor *nor, loff_t to,
 	if (ret)
 		return ret;
 
-	return (ret < 0) ? ret : len;
+	return len;
 }
 
 static ssize_t cqspi_read(struct spi_nor *nor, loff_t from,
@@ -913,7 +913,7 @@ static ssize_t cqspi_read(struct spi_nor *nor, loff_t from,
 	if (ret)
 		return ret;
 
-	return (ret < 0) ? ret : len;
+	return len;
 }
 
 static int cqspi_erase(struct spi_nor *nor, loff_t offs)
-- 
2.10.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove redundant dead code on error return check
  2017-01-31 15:53 [PATCH] mtd: spi-nor: cqspi: remove redundant dead code on error return check Colin King
@ 2017-01-31 16:39 ` Richard Weinberger
  2017-01-31 19:30 ` Marek Vasut
  2017-02-02  9:47 ` Cyrille Pitchen
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2017-01-31 16:39 UTC (permalink / raw)
  To: Colin King, Cyrille Pitchen, Marek Vasut, David Woodhouse,
	Brian Norris, Boris Brezillon, linux-mtd
  Cc: kernel-janitors, linux-kernel

Am 31.01.2017 um 16:53 schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Checking for ret < 0 is redundant because a previous check on ret
> being non-zero already handles the ret < 0 case. Remove the redundant
> code. Found by CoverityScan, CID#1398863, CID#1398864
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove redundant dead code on error return check
  2017-01-31 15:53 [PATCH] mtd: spi-nor: cqspi: remove redundant dead code on error return check Colin King
  2017-01-31 16:39 ` Richard Weinberger
@ 2017-01-31 19:30 ` Marek Vasut
  2017-02-02  9:47 ` Cyrille Pitchen
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2017-01-31 19:30 UTC (permalink / raw)
  To: Colin King, Cyrille Pitchen, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger, linux-mtd
  Cc: kernel-janitors, linux-kernel

On 01/31/2017 04:53 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Checking for ret < 0 is redundant because a previous check on ret
> being non-zero already handles the ret < 0 case. Remove the redundant
> code. Found by CoverityScan, CID#1398863, CID#1398864
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Marek Vasut <marek.vasut@gmail.com>

Thanks

> ---
>  drivers/mtd/spi-nor/cadence-quadspi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index 3fb7be8..9f8102d 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -893,7 +893,7 @@ static ssize_t cqspi_write(struct spi_nor *nor, loff_t to,
>  	if (ret)
>  		return ret;
>  
> -	return (ret < 0) ? ret : len;
> +	return len;
>  }
>  
>  static ssize_t cqspi_read(struct spi_nor *nor, loff_t from,
> @@ -913,7 +913,7 @@ static ssize_t cqspi_read(struct spi_nor *nor, loff_t from,
>  	if (ret)
>  		return ret;
>  
> -	return (ret < 0) ? ret : len;
> +	return len;
>  }
>  
>  static int cqspi_erase(struct spi_nor *nor, loff_t offs)
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove redundant dead code on error return check
  2017-01-31 15:53 [PATCH] mtd: spi-nor: cqspi: remove redundant dead code on error return check Colin King
  2017-01-31 16:39 ` Richard Weinberger
  2017-01-31 19:30 ` Marek Vasut
@ 2017-02-02  9:47 ` Cyrille Pitchen
  2 siblings, 0 replies; 4+ messages in thread
From: Cyrille Pitchen @ 2017-02-02  9:47 UTC (permalink / raw)
  To: Colin King, Marek Vasut, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger, linux-mtd
  Cc: kernel-janitors, linux-kernel

Le 31/01/2017 à 16:53, Colin King a écrit :
> From: Colin Ian King <colin.king@canonical.com>
> 
> Checking for ret < 0 is redundant because a previous check on ret
> being non-zero already handles the ret < 0 case. Remove the redundant
> code. Found by CoverityScan, CID#1398863, CID#1398864
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to the github spi-nor tree.

Thanks!
> ---
>  drivers/mtd/spi-nor/cadence-quadspi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index 3fb7be8..9f8102d 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -893,7 +893,7 @@ static ssize_t cqspi_write(struct spi_nor *nor, loff_t to,
>  	if (ret)
>  		return ret;
>  
> -	return (ret < 0) ? ret : len;
> +	return len;
>  }
>  
>  static ssize_t cqspi_read(struct spi_nor *nor, loff_t from,
> @@ -913,7 +913,7 @@ static ssize_t cqspi_read(struct spi_nor *nor, loff_t from,
>  	if (ret)
>  		return ret;
>  
> -	return (ret < 0) ? ret : len;
> +	return len;
>  }
>  
>  static int cqspi_erase(struct spi_nor *nor, loff_t offs)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-02  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31 15:53 [PATCH] mtd: spi-nor: cqspi: remove redundant dead code on error return check Colin King
2017-01-31 16:39 ` Richard Weinberger
2017-01-31 19:30 ` Marek Vasut
2017-02-02  9:47 ` Cyrille Pitchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®