Skip to contentSkip to conversation

loop.c warning removal

PATCH New Rusty Russell 1 participant 1 message May 13, 2003 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 loop.c warning removal

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.

drivers/block/loop.c +6 -3
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
@@ -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.