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

Commit 90ee1fb3 authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Artem Bityutskiy
Browse files

mtd: jz4740_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: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 4571c139
Loading
Loading
Loading
Loading
+3 −8
Original line number Original line Diff line number Diff line
@@ -295,8 +295,6 @@ static int __devinit jz_nand_probe(struct platform_device *pdev)
	struct nand_chip *chip;
	struct nand_chip *chip;
	struct mtd_info *mtd;
	struct mtd_info *mtd;
	struct jz_nand_platform_data *pdata = pdev->dev.platform_data;
	struct jz_nand_platform_data *pdata = pdev->dev.platform_data;
	struct mtd_partition *partition_info;
	int num_partitions = 0;


	nand = kzalloc(sizeof(*nand), GFP_KERNEL);
	nand = kzalloc(sizeof(*nand), GFP_KERNEL);
	if (!nand) {
	if (!nand) {
@@ -369,12 +367,9 @@ static int __devinit jz_nand_probe(struct platform_device *pdev)
		goto err_gpio_free;
		goto err_gpio_free;
	}
	}


	num_partitions = parse_mtd_partitions(mtd, NULL, &partition_info, 0);
	ret = mtd_device_parse_register(mtd, NULL, 0,
	if (num_partitions <= 0 && pdata) {
			pdata ? pdata->partitions : NULL,
		num_partitions = pdata->num_partitions;
			pdata ? pdata->num_partitions : 0);
		partition_info = pdata->partitions;
	}
	ret = mtd_device_register(mtd, partition_info, num_partitions);


	if (ret) {
	if (ret) {
		dev_err(&pdev->dev, "Failed to add mtd device\n");
		dev_err(&pdev->dev, "Failed to add mtd device\n");