public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2] mtd: spi-nor: Fix some error codes in cqspi_setup_flash()
@ 2016-10-13  8:30 Dan Carpenter
  2016-10-14  7:16 ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2016-10-13  8:30 UTC (permalink / raw)
  To: David Woodhouse, Graham Moore
  Cc: Brian Norris, Marek Vasut, linux-mtd, kernel-janitors

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>

diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index 944863b..d489fbd 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -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;
 		}

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

end of thread, other threads:[~2016-11-28  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-13  8:30 [patch 2/2] mtd: spi-nor: Fix some error codes in cqspi_setup_flash() Dan Carpenter
2016-10-14  7:16 ` Marek Vasut
2016-10-15 22:09   ` Moritz Fischer
2016-11-28  8:20     ` Cyrille Pitchen

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