Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ded4c55d authored by Sachin Kamat's avatar Sachin Kamat Committed by Artem Bityutskiy
Browse files

mtd: s3c2410: Fix potential NULL pointer dereference error



'set' is tested for NULL. But subsequently accessed without the check.
Thus making it conditional to avoid NULL pointer dereferencing.

Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 2cbba75a
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -730,13 +730,16 @@ static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,
				      struct s3c2410_nand_mtd *mtd,
				      struct s3c2410_nand_set *set)
{
	if (set)
	if (set) {
		mtd->mtd.name = set->name;

		return mtd_device_parse_register(&mtd->mtd, NULL, NULL,
					 set->partitions, set->nr_partitions);
	}

	return -ENODEV;
}

/**
 * s3c2410_nand_init_chip - initialise a single instance of an chip
 * @info: The base NAND controller the chip is on.