linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ubi: gluebi: Fix double refcounting
@ 2016-07-04 20:06 Richard Weinberger
  2016-07-04 20:06 ` [PATCH 2/2] ubi: Fix early logging Richard Weinberger
  2016-07-04 20:10 ` [PATCH 1/2 v2] ubi: gluebi: Fix double refcounting Richard Weinberger
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Weinberger @ 2016-07-04 20:06 UTC (permalink / raw)
  To: linux-mtd; +Cc: computersforpeace, dwmw2, richard, dedekind1

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>
---
 drivers/mtd/ubi/gluebi.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/mtd/ubi/gluebi.c b/drivers/mtd/ubi/gluebi.c
index cb7c075..ea1016f 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;
 
@@ -153,7 +150,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);
 }
 
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-04 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-04 20:06 [PATCH 1/2] ubi: gluebi: Fix double refcounting Richard Weinberger
2016-07-04 20:06 ` [PATCH 2/2] ubi: Fix early logging Richard Weinberger
2016-07-04 20:10 ` [PATCH 1/2 v2] ubi: gluebi: Fix double refcounting Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).