mtd: socrates_nand.c: use mtd_device_parse_register

Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
This commit is contained in:
Dmitry Eremin-Solenikov 2011-06-02 18:01:07 +04:00 committed by Artem Bityutskiy
parent a910649708
commit b2a5a4878e

View File

@ -164,8 +164,6 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
struct mtd_info *mtd;
struct nand_chip *nand_chip;
int res;
struct mtd_partition *partitions = NULL;
int num_partitions = 0;
struct mtd_part_parser_data ppdata;
/* Allocate memory for the device structure (and zero it) */
@ -225,17 +223,10 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
goto out;
}
num_partitions = parse_mtd_partitions(mtd, NULL, &partitions, &ppdata);
if (num_partitions < 0) {
res = num_partitions;
goto release;
}
res = mtd_device_register(mtd, partitions, num_partitions);
res = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
if (!res)
return res;
release:
nand_release(mtd);
out: