diff mbox series

[U-Boot,3/3] cmd: sata: add null pointer check for dev

Message ID 20190124142957.15040-4-marcel@ziswiler.com
State Superseded
Delegated to: Tom Rini
Headers show
Series While converting SATA on Apalis iMX6 to use driver model I noticed it | expand

Commit Message

Marcel Ziswiler Jan. 24, 2019, 2:29 p.m. UTC
From: Marcel Ziswiler <marcel.ziswiler@toradex.com>

Calling sata_scan() with a null pointer probably won't make much sense.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

---

 cmd/sata.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass Jan. 24, 2019, 8:18 p.m. UTC | #1
On Fri, 25 Jan 2019 at 03:30, Marcel Ziswiler <marcel@ziswiler.com> wrote:
>
> From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>
> Calling sata_scan() with a null pointer probably won't make much sense.
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>
> ---
>
>  cmd/sata.c | 4 ++++
>  1 file changed, 4 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

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