diff options
author | Richard Weinberger <richard@nod.at> | 2016-07-04 16:10:13 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-07-29 17:31:54 -0400 |
commit | 95b54e1e10eb32c465d1028dd119ee790afe4a01 (patch) | |
tree | c7e4a5af521227e7194460502eccb308a435bc60 /drivers/mtd | |
parent | dccbc9197d2c3614f2fd6811874e1d982e4415f0 (diff) |
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')
-rw-r--r-- | drivers/mtd/ubi/gluebi.c | 5 |
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) | |||
99 | struct gluebi_device *gluebi; | 99 | struct gluebi_device *gluebi; |
100 | int ubi_mode = UBI_READONLY; | 100 | int ubi_mode = UBI_READONLY; |
101 | 101 | ||
102 | if (!try_module_get(THIS_MODULE)) | ||
103 | return -ENODEV; | ||
104 | |||
105 | if (mtd->flags & MTD_WRITEABLE) | 102 | if (mtd->flags & MTD_WRITEABLE) |
106 | ubi_mode = UBI_READWRITE; | 103 | ubi_mode = UBI_READWRITE; |
107 | 104 | ||
@@ -129,7 +126,6 @@ static int gluebi_get_device(struct mtd_info *mtd) | |||
129 | ubi_mode); | 126 | ubi_mode); |
130 | if (IS_ERR(gluebi->desc)) { | 127 | if (IS_ERR(gluebi->desc)) { |
131 | mutex_unlock(&devices_mutex); | 128 | mutex_unlock(&devices_mutex); |
132 | module_put(THIS_MODULE); | ||
133 | return PTR_ERR(gluebi->desc); | 129 | return PTR_ERR(gluebi->desc); |
134 | } | 130 | } |
135 | gluebi->refcnt += 1; | 131 | gluebi->refcnt += 1; |
@@ -153,7 +149,6 @@ static void gluebi_put_device(struct mtd_info *mtd) | |||
153 | gluebi->refcnt -= 1; | 149 | gluebi->refcnt -= 1; |
154 | if (gluebi->refcnt == 0) | 150 | if (gluebi->refcnt == 0) |
155 | ubi_close_volume(gluebi->desc); | 151 | ubi_close_volume(gluebi->desc); |
156 | module_put(THIS_MODULE); | ||
157 | mutex_unlock(&devices_mutex); | 152 | mutex_unlock(&devices_mutex); |
158 | } | 153 | } |
159 | 154 | ||