mtd: r852: Fix device_create_file() usage
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue Jun 23 10:59:08 PDT 2015
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=905cce7f4309f3ec19c1ed67edd68b7e67e88f3e
Commit: 905cce7f4309f3ec19c1ed67edd68b7e67e88f3e
Parent: 5e65d48b6049e090fdc57490db9d797124f2a9eb
Author: Richard Weinberger <richard at nod.at>
AuthorDate: Mon Jun 1 23:10:49 2015 +0200
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Jun 16 18:58:46 2015 -0700
mtd: r852: Fix device_create_file() usage
device_create_file() can fail, therefore we have to
handle this case and abort.
Signed-off-by: Richard Weinberger <richard at nod.at>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/nand/r852.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index baea83f..77e96d2 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -653,11 +653,15 @@ static int r852_register_nand_device(struct r852_device *dev)
if (sm_register_device(dev->mtd, dev->sm))
goto error2;
- if (device_create_file(&dev->mtd->dev, &dev_attr_media_type))
+ if (device_create_file(&dev->mtd->dev, &dev_attr_media_type)) {
message("can't create media type sysfs attribute");
+ goto error3;
+ }
dev->card_registred = 1;
return 0;
+error3:
+ nand_release(dev->mtd);
error2:
kfree(dev->mtd);
error1:
More information about the linux-mtd-cvs
mailing list