summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-11-16 16:08:22 +0530
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-11-18 12:44:38 +0200
commitded4c55d108e0e4e4ba221b39a782e85d77a5ca0 (patch)
tree174b12ca34284777de7fd47586b9f09409a5f743 /drivers/mtd
parent2cbba75a56ea78e6876b4e2547a882f10b3fe72b (diff)
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: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/s3c2410.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 295e4bedad9..bbc49c49607 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -730,11 +730,14 @@ 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,
+ return mtd_device_parse_register(&mtd->mtd, NULL, NULL,
set->partitions, set->nr_partitions);
+ }
+
+ return -ENODEV;
}
/**