Skip to contentSkip to conversation

spi: cadence_qspi: Fix checking return value of fdt_first_subnode()

PATCH New Axel Lin 2 participants 2 messages Jan 7, 2015 SPI

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 spi: cadence_qspi: Fix checking return value of fdt_first_subnode()

fdt_first_subnode() returns -FDT_ERR_NOTFOUND if no subnode found. 0 is supposed to be a valid offset returns from fdt_first_subnode().

---
 drivers/spi/cadence_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/cadence_qspi.c +1 -1
index fa95b19..98ae3b8 100644
@@ -297,7 +297,7 @@ static int cadence_spi_ofdata_to_platdata(struct udevice *bus)
 
 	/* All other paramters are embedded in the child node */
 	subnode = fdt_first_subnode(blob, node);
-	if (!subnode) {
+	if (subnode < 0) {
 		printf("Error: subnode with SPI flash config missing!\n");
 		return -ENODEV;
 	}
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 spi: cadence_qspi: Fix checking return value of fdt_first_subnode()

Quoted 22 lines · Axel Lin

fdt_first_subnode() returns -FDT_ERR_NOTFOUND if no subnode found. 0 is supposed to be a valid offset returns from fdt_first_subnode().

---
 drivers/spi/cadence_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/cadence_qspi.c +1 -2
index fa95b19..98ae3b8 100644
@@ -297,7 +297,7 @@ static int cadence_spi_ofdata_to_platdata(struct udevice *bus)
 
        /* All other paramters are embedded in the child node */
        subnode = fdt_first_subnode(blob, node);
-       if (!subnode) {
+       if (subnode < 0) {
                printf("Error: subnode with SPI flash config missing!\n");
                return -ENODEV;
        }
--
Quoted 1 line

1.9.1

Applied to u-boot-spi/master

thanks!

Signature · 1 line
Jagan.