diff options
author | Richard Weinberger <richard@nod.at> | 2015-06-01 23:10:49 +0200 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-06-16 18:58:46 -0700 |
commit | 905cce7f4309f3ec19c1ed67edd68b7e67e88f3e (patch) | |
tree | 5c7ff2e829abe33071734fc078cb182f4b173001 /drivers/mtd | |
parent | 5e65d48b6049e090fdc57490db9d797124f2a9eb (diff) |
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@nod.at>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/r852.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c index baea83f4dea8..77e96d2df96c 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: |