]> git.baikalelectronics.ru Git - kernel.git/commitdiff
memory: ti-aemif: fix a potential NULL-pointer dereference
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Thu, 6 Sep 2018 12:12:19 +0000 (14:12 +0200)
committerOlof Johansson <olof@lixom.net>
Thu, 6 Sep 2018 17:04:07 +0000 (10:04 -0700)
Platform data pointer may be NULL. We check it everywhere but in one
place. Fix it.

Fixes: b6d5681ac40a ("memory: aemif: add support for board files")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: stable@vger.kernel.org
Signed-off-by: Olof Johansson <olof@lixom.net>
drivers/memory/ti-aemif.c

index 31112f622b884f2577d46caec86b2b63370e81de..475e5b3790edb4085055fcd38df2f6d77d98388d 100644 (file)
@@ -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]);