spi: cadence_qspi: Fix checking return value of fdt_first_subnode()
authorAxel Lin <axel.lin@ingics.com>
Wed, 7 Jan 2015 01:54:56 +0000 (09:54 +0800)
committerJagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Wed, 7 Jan 2015 07:00:54 +0000 (12:30 +0530)
fdt_first_subnode() returns -FDT_ERR_NOTFOUND if no subnode found.
0 is supposed to be a valid offset returns from fdt_first_subnode().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
drivers/spi/cadence_qspi.c

index fa95b19ecddc71355435fcb5d591d57f43687515..98ae3b808fb0a970b9e467e94bef0e336458bd19 100644 (file)
@@ -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;
        }