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>
This commit is contained in:
Richard Weinberger 2016-07-04 22:10:13 +02:00
Родитель dccbc9197d
Коммит 95b54e1e10
1 изменённых файлов: 0 добавлений и 5 удалений

Просмотреть файл

@ -99,9 +99,6 @@ static int gluebi_get_device(struct mtd_info *mtd)
struct gluebi_device *gluebi; struct gluebi_device *gluebi;
int ubi_mode = UBI_READONLY; int ubi_mode = UBI_READONLY;
if (!try_module_get(THIS_MODULE))
return -ENODEV;
if (mtd->flags & MTD_WRITEABLE) if (mtd->flags & MTD_WRITEABLE)
ubi_mode = UBI_READWRITE; ubi_mode = UBI_READWRITE;
@ -129,7 +126,6 @@ static int gluebi_get_device(struct mtd_info *mtd)
ubi_mode); ubi_mode);
if (IS_ERR(gluebi->desc)) { if (IS_ERR(gluebi->desc)) {
mutex_unlock(&devices_mutex); mutex_unlock(&devices_mutex);
module_put(THIS_MODULE);
return PTR_ERR(gluebi->desc); return PTR_ERR(gluebi->desc);
} }
gluebi->refcnt += 1; gluebi->refcnt += 1;
@ -153,7 +149,6 @@ static void gluebi_put_device(struct mtd_info *mtd)
gluebi->refcnt -= 1; gluebi->refcnt -= 1;
if (gluebi->refcnt == 0) if (gluebi->refcnt == 0)
ubi_close_volume(gluebi->desc); ubi_close_volume(gluebi->desc);
module_put(THIS_MODULE);
mutex_unlock(&devices_mutex); mutex_unlock(&devices_mutex);
} }