From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:50680 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727617AbeIFQro (ORCPT ); Thu, 6 Sep 2018 12:47:44 -0400 Received: by mail-wm0-f67.google.com with SMTP id s12-v6so11213948wmc.0 for ; Thu, 06 Sep 2018 05:12:32 -0700 (PDT) From: Bartosz Golaszewski To: Santosh Shilimkar , Sekhar Nori , Kevin Hilman , Dan Carpenter Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , stable@vger.kernel.org Subject: [PATCH] memory: ti-aemif: fix a potential NULL-pointer dereference Date: Thu, 6 Sep 2018 14:12:19 +0200 Message-Id: <20180906121219.23948-1-brgl@bgdev.pl> Sender: stable-owner@vger.kernel.org List-ID: From: Bartosz Golaszewski Platform data pointer may be NULL. We check it everywhere but in one place. Fix it. Fixes: 8af70cd2ca50 ("memory: aemif: add support for board files") Reported-by: Dan Carpenter Signed-off-by: Bartosz Golaszewski Cc: stable@vger.kernel.org --- drivers/memory/ti-aemif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index 31112f622b88..475e5b3790ed 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -411,7 +411,7 @@ static int aemif_probe(struct platform_device *pdev) if (ret < 0) goto error; } - } else { + } else if (pdata) { for (i = 0; i < pdata->num_sub_devices; i++) { pdata->sub_devices[i].dev.parent = dev; ret = platform_device_register(&pdata->sub_devices[i]); -- 2.18.0