cmd: sata: add null pointer check for dev

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>
This commit is contained in:
Marcel Ziswiler 2019-02-01 16:01:08 +01:00 committed by Tom Rini
parent f388564965
commit b3860bfe77

View 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);