]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: sata: add null pointer check for dev
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>
Fri, 1 Feb 2019 15:01:08 +0000 (16:01 +0100)
committerTom Rini <trini@konsulko.com>
Sat, 9 Feb 2019 12:51:00 +0000 (07:51 -0500)
Calling sata_scan() with a null pointer probably won't make much sense.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/sata.c

index 6d62ba8f74aaceb9702d9db361e68966b89b304a..a73cc54bd3e97b7ad535a52fc153697e74e37e69 100644 (file)
@@ -60,6 +60,10 @@ int sata_probe(int devnum)
                printf("Cannot probe SATA device %d (err=%d)\n", devnum, rc);
                return CMD_RET_FAILURE;
        }
+       if (!dev) {
+               printf("No SATA device found!\n");
+               return CMD_RET_FAILURE;
+       }
        rc = sata_scan(dev);
        if (rc) {
                printf("Cannot scan SATA device %d (err=%d)\n", devnum, rc);