diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2018-02-10 01:28:36 +0300 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-02-12 23:36:05 +0100 |
commit | 1b8c90985f59ccd8a1adb723b58b42628b36e668 (patch) | |
tree | 6016752703403f6ebef2f9eda58af162ccf84eea | |
parent | 196644fd09ab7bf47040c0bdd1b48fc3c2bc08a6 (diff) | |
download | op-kernel-dev-1b8c90985f59ccd8a1adb723b58b42628b36e668.zip op-kernel-dev-1b8c90985f59ccd8a1adb723b58b42628b36e668.tar.gz |
mtd: nand: vf610: check mtd_device_register() return code
vf610_nfc_probe() misses error handling of mtd_device_register().
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
-rw-r--r-- | drivers/mtd/nand/vf610_nfc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c index 1939503..5d7a1f8 100644 --- a/drivers/mtd/nand/vf610_nfc.c +++ b/drivers/mtd/nand/vf610_nfc.c @@ -767,8 +767,13 @@ static int vf610_nfc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mtd); /* Register device in MTD */ - return mtd_device_register(mtd, NULL, 0); + err = mtd_device_register(mtd, NULL, 0); + if (err) + goto err_cleanup_nand; + return 0; +err_cleanup_nand: + nand_cleanup(chip); err_disable_clk: clk_disable_unprepare(nfc->clk); return err; |