[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1433193054-26865-2-git-send-email-richard@nod.at>
Date: Mon, 1 Jun 2015 23:10:49 +0200
From: Richard Weinberger <richard@....at>
To: computersforpeace@...il.com
Cc: dwmw2@...radead.org, maximlevitsky@...il.com,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
Richard Weinberger <richard@....at>
Subject: [PATCH 1/6] 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>
---
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:
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists