From: Dan Carpenter Date: Fri, 15 Jul 2016 11:06:30 +0000 (+0300) Subject: mtd: maps: sa1100-flash: potential NULL dereference X-Git-Tag: v4.8-rc1~57^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc01a28d80a42cef08c94dfc595565aaebe46d15;p=platform%2Fkernel%2Flinux-exynos.git mtd: maps: sa1100-flash: potential NULL dereference We check for NULL but then dereference "info->mtd" on the next line. Fixes: 72169755cf36 ('mtd: maps: sa1100-flash: show parent device in sysfs') Signed-off-by: Dan Carpenter Signed-off-by: Brian Norris --- diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 142fc3d..784c6e1 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c @@ -230,8 +230,10 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev, info->mtd = mtd_concat_create(cdev, info->num_subdev, plat->name); - if (info->mtd == NULL) + if (info->mtd == NULL) { ret = -ENXIO; + goto err; + } } info->mtd->dev.parent = &pdev->dev;