summaryrefslogtreecommitdiff
path: root/cmd/sata.c
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2019-02-01 16:01:08 +0100
committerTom Rini <trini@konsulko.com>2019-02-09 07:51:00 -0500
commitb3860bfe779f71708f380392ef195e137981d7ad (patch)
tree857f40b8a79634e8bb938ec206f8beae009032b4 /cmd/sata.c
parentf3885649657b4dfb669ae4505a0516c3affb8694 (diff)
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>
Diffstat (limited to 'cmd/sata.c')
-rw-r--r--cmd/sata.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/sata.c b/cmd/sata.c
index 6d62ba8f74..a73cc54bd3 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -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);