Commit 10ad1d75 authored by Dan Carpenter's avatar Dan Carpenter Committed by Cyrille Pitchen

mtd: spi-nor: Fix some error codes in cqspi_setup_flash()

We return success or possibly uninitialized values on these error paths
instead of proper error codes.

Fixes: 14062341 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarMarek Vasut <marex@denx.de>
Reviewed-by: default avatarMoritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: default avatarCyrille Pitchen <cyrille.pitchen@atmel.com>
parent 193e8714
...@@ -1077,12 +1077,14 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np) ...@@ -1077,12 +1077,14 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np)
/* Get flash device data */ /* Get flash device data */
for_each_available_child_of_node(dev->of_node, np) { 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"); dev_err(dev, "Couldn't determine chip select.\n");
goto err; goto err;
} }
if (cs >= CQSPI_MAX_CHIPSELECT) { if (cs >= CQSPI_MAX_CHIPSELECT) {
ret = -EINVAL;
dev_err(dev, "Chip select %d out of range.\n", cs); dev_err(dev, "Chip select %d out of range.\n", cs);
goto err; goto err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment