mtd: spi-nor: cqspi: remove redundant dead code on error return check

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Feb 12 18:59:13 PST 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=7fa2c7038cc0ec16ae5d8eee347ea136de0f4b65
Commit:     7fa2c7038cc0ec16ae5d8eee347ea136de0f4b65
Parent:     35fd766117de41ed475948410c3ec5ab07cd3d03
Author:     Colin Ian King <colin.king at canonical.com>
AuthorDate: Tue Jan 31 15:53:17 2017 +0000
Committer:  Cyrille Pitchen <cyrille.pitchen at atmel.com>
CommitDate: Fri Feb 10 14:22:00 2017 +0100

    mtd: spi-nor: cqspi: remove redundant dead code on error return check
    
    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 at canonical.com>
    Reviewed-by: Richard Weinberger <richard at nod.at>
    Acked-by: Marek Vasut <marek.vasut at gmail.com>
    Signed-off-by: Cyrille Pitchen <cyrille.pitchen at atmel.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)



More information about the linux-mtd-cvs mailing list