summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2016-07-04 22:10:13 +0200
committerRichard Weinberger <richard@nod.at>2016-07-29 23:31:54 +0200
commit95b54e1e10eb32c465d1028dd119ee790afe4a01 (patch)
treec7e4a5af521227e7194460502eccb308a435bc60 /drivers/mtd/ubi
parentubifs: Silence early error messages if MS_SILENT is set (diff)
downloadlinux-95b54e1e10eb32c465d1028dd119ee790afe4a01.tar.xz
linux-95b54e1e10eb32c465d1028dd119ee790afe4a01.zip
ubi: gluebi: Fix double refcounting
There is no need to call get/put on the module reference in gluebi_get/put_device() callbacks. Since mtd->owner is the gluebi module itself mtdcore.c will take care of proper refcounting in __get/put_mtd_device() before executing the callbacks. Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/gluebi.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/mtd/ubi/gluebi.c b/drivers/mtd/ubi/gluebi.c
index cb7c075f2144..1cb287ec32ad 100644
--- a/drivers/mtd/ubi/gluebi.c
+++ b/drivers/mtd/ubi/gluebi.c
@@ -99,9 +99,6 @@ static int gluebi_get_device(struct mtd_info *mtd)
struct gluebi_device *gluebi;
int ubi_mode = UBI_READONLY;
- if (!try_module_get(THIS_MODULE))
- return -ENODEV;
-
if (mtd->flags & MTD_WRITEABLE)
ubi_mode = UBI_READWRITE;
@@ -129,7 +126,6 @@ static int gluebi_get_device(struct mtd_info *mtd)
ubi_mode);
if (IS_ERR(gluebi->desc)) {
mutex_unlock(&devices_mutex);
- module_put(THIS_MODULE);
return PTR_ERR(gluebi->desc);
}
gluebi->refcnt += 1;
@@ -153,7 +149,6 @@ static void gluebi_put_device(struct mtd_info *mtd)
gluebi->refcnt -= 1;
if (gluebi->refcnt == 0)
ubi_close_volume(gluebi->desc);
- module_put(THIS_MODULE);
mutex_unlock(&devices_mutex);
}