Commit 45987838 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

mtd: maps: sa1100-flash: potential NULL dereference

commit dc01a28d upstream.

We check for NULL but then dereference "info->mtd" on the next line.

Fixes: 72169755 ('mtd: maps: sa1100-flash: show parent device in sysfs')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f5d8326
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment