]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: onenand: samsung: return an error if 'mtd_device_parse_register()' fails
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 14 Dec 2017 06:03:50 +0000 (07:03 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Mon, 18 Dec 2017 16:37:51 +0000 (17:37 +0100)
If 'mtd_device_parse_register()' fails, we still return 0 which mean
success.
Return the error code instead, as done in all the other error handling
paths.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/onenand/samsung.c

index bad59f5cc56d67231c0d0625ecb02198fd81c9bc..c5416d6ad5719b2389ec449b671672a4b5156c77 100644 (file)
@@ -937,6 +937,11 @@ static int s3c_onenand_probe(struct platform_device *pdev)
        err = mtd_device_parse_register(mtd, NULL, NULL,
                                        pdata ? pdata->parts : NULL,
                                        pdata ? pdata->nr_parts : 0);
+       if (err) {
+               dev_err(&pdev->dev, "failed to parse partitions and register the MTD device\n");
+               onenand_release(mtd);
+               return err;
+       }
 
        platform_set_drvdata(pdev, mtd);