[PATCH] loop.c warning removal

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Tue May 13 2003 - 01:03:59 EST


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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu May 15 2003 - 22:00:44 EST