]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mtd: spi-nor: Fix some error codes in cqspi_setup_flash()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 13 Oct 2016 08:30:39 +0000 (11:30 +0300)
committerCyrille Pitchen <cyrille.pitchen@atmel.com>
Sat, 26 Nov 2016 15:50:13 +0000 (16:50 +0100)
We return success or possibly uninitialized values on these error paths
instead of proper error codes.

Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
drivers/mtd/spi-nor/cadence-quadspi.c

index 944863be0320dfbad9b341705b49356f1c0700ec..d489fbd07c12b6e73bf0f73e5f3de2696d4da3c4 100644 (file)
@@ -1077,12 +1077,14 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np)
 
        /* Get flash device data */
        for_each_available_child_of_node(dev->of_node, np) {
-               if (of_property_read_u32(np, "reg", &cs)) {
+               ret = of_property_read_u32(np, "reg", &cs);
+               if (ret) {
                        dev_err(dev, "Couldn't determine chip select.\n");
                        goto err;
                }
 
                if (cs >= CQSPI_MAX_CHIPSELECT) {
+                       ret = -EINVAL;
                        dev_err(dev, "Chip select %d out of range.\n", cs);
                        goto err;
                }