* [PATCH] loop.c warning removal
@ 2003-05-13 6:03 Rusty Russell
0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2003-05-13 6:03 UTC (permalink / raw)
To: torvalds, viro; +Cc: linux-kernel
loop.c has one of those places where maniping own refcounts is safe:
to get into the ioctl handler you need to have the device open, so
that holds a refcount already (verified that this actually happens).
The compile warning is irritating.
Rusty.
diff -urNp --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.5.69-bk7/drivers/block/loop.c working-2.5.69-bk7-mingo/drivers/block/loop.c
--- linux-2.5.69-bk7/drivers/block/loop.c 2003-05-05 12:36:58.000000000 +1000
+++ working-2.5.69-bk7-mingo/drivers/block/loop.c 2003-05-13 15:59:02.000000000 +1000
@@ -651,7 +651,8 @@ static int loop_set_fd(struct loop_devic
int lo_flags = 0;
int error;
- MOD_INC_USE_COUNT;
+ /* This is safe, since we have a reference from open(). */
+ __module_get(THIS_MODULE);
error = -EBUSY;
if (lo->lo_state != Lo_unbound)
@@ -751,7 +752,8 @@ static int loop_set_fd(struct loop_devic
out_putf:
fput(file);
out:
- MOD_DEC_USE_COUNT;
+ /* This is safe: open() is still holding a reference. */
+ module_put(THIS_MODULE);
return error;
}
@@ -824,7 +826,8 @@ static int loop_clr_fd(struct loop_devic
filp->f_dentry->d_inode->i_mapping->gfp_mask = gfp;
lo->lo_state = Lo_unbound;
fput(filp);
- MOD_DEC_USE_COUNT;
+ /* This is safe: open() is still holding a reference. */
+ module_put(THIS_MODULE);
return 0;
}
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-13 7:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-13 6:03 [PATCH] loop.c warning removal Rusty Russell
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).