From: Marcel Ziswiler Date: Fri, 1 Feb 2019 16:01:08 +0100 Subject: [U-Boot] [PATCH v3 2/2] cmd: sata: add null pointer check for dev In-Reply-To: <20190201150109.4450-1-marcel@ziswiler.com> References: <20190201150109.4450-1-marcel@ziswiler.com> Message-ID: <20190201150109.4450-3-marcel@ziswiler.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Marcel Ziswiler Calling sata_scan() with a null pointer probably won't make much sense. Signed-off-by: Marcel Ziswiler Reviewed-by: Simon Glass --- Changes in v3: None Changes in v2: - Dropped "[PATCH 2/3] dm: sata: add null pointer check for dev" as suggested by Simon. - Added Simon's reviewed-by. cmd/sata.c | 4 ++++ 1 file changed, 4 insertions(+) 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); -- 2.20.1