Commit 2ce6b74d authored by Andrew Morton's avatar Andrew Morton Committed by Patrick Mochel

[PATCH] loop.c warning removal

From: Rusty Russell <rusty@rustcorp.com.au>

loop.c has one of those places where manipulating 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.
parent 4acff84c
...@@ -651,7 +651,8 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, ...@@ -651,7 +651,8 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
int lo_flags = 0; int lo_flags = 0;
int error; int error;
MOD_INC_USE_COUNT; /* This is safe, since we have a reference from open(). */
__module_get(THIS_MODULE);
error = -EBUSY; error = -EBUSY;
if (lo->lo_state != Lo_unbound) if (lo->lo_state != Lo_unbound)
...@@ -751,7 +752,8 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, ...@@ -751,7 +752,8 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
out_putf: out_putf:
fput(file); fput(file);
out: out:
MOD_DEC_USE_COUNT; /* This is safe: open() is still holding a reference. */
module_put(THIS_MODULE);
return error; return error;
} }
...@@ -824,7 +826,8 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) ...@@ -824,7 +826,8 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
filp->f_dentry->d_inode->i_mapping->gfp_mask = gfp; filp->f_dentry->d_inode->i_mapping->gfp_mask = gfp;
lo->lo_state = Lo_unbound; lo->lo_state = Lo_unbound;
fput(filp); fput(filp);
MOD_DEC_USE_COUNT; /* This is safe: open() is still holding a reference. */
module_put(THIS_MODULE);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment