mtd: spi-nor: cqspi: remove redundant dead code on error return check
authorColin Ian King <colin.king@canonical.com>
Tue, 31 Jan 2017 15:53:17 +0000 (15:53 +0000)
committerCyrille Pitchen <cyrille.pitchen@atmel.com>
Fri, 10 Feb 2017 13:22:00 +0000 (14:22 +0100)
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>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
drivers/mtd/spi-nor/cadence-quadspi.c

index 3fb7be857bb6348afee8ea701474094b29bb77fa..9f8102de1b16a1786c5fb06f7980acc872433dd5 100644 (file)
@@ -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)