Commit f7efec4a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] gratitious MOD_INC_USE_COUNT

dasd_proc.c : should be using ->owner instead of MOD_..._USE_COUNT in
->open()/->release().

s390/char/tape.c, s390/char/tapechar.c, usb/image/scanner.c,
intermezzo/psdev.c: ditto

intermezzo/super.c: they forgot to remove MOD_INC_USE_COUNT from the
..._fill_super()

binfmt_som.c: ->load_binary() and ->load_library() don't need
MOD_INC_USE_COUNT, since ->module is correctly set.
parent 32735425
...@@ -65,7 +65,6 @@ dasd_generic_close (struct inode *inode, struct file *file) ...@@ -65,7 +65,6 @@ dasd_generic_close (struct inode *inode, struct file *file)
vfree (info->data); vfree (info->data);
kfree (info); kfree (info);
} }
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -223,12 +222,10 @@ dasd_devices_open(struct inode *inode, struct file *file) ...@@ -223,12 +222,10 @@ dasd_devices_open(struct inode *inode, struct file *file)
int size, len; int size, len;
int devindex; int devindex;
MOD_INC_USE_COUNT;
info = (tempinfo_t *) kmalloc(sizeof (tempinfo_t), GFP_KERNEL); info = (tempinfo_t *) kmalloc(sizeof (tempinfo_t), GFP_KERNEL);
if (info == NULL) { if (info == NULL) {
MESSAGE(KERN_WARNING, "%s", MESSAGE(KERN_WARNING, "%s",
"No memory available for data (tempinfo)"); "No memory available for data (tempinfo)");
MOD_DEC_USE_COUNT;
return -ENOMEM; return -ENOMEM;
} }
...@@ -239,7 +236,6 @@ dasd_devices_open(struct inode *inode, struct file *file) ...@@ -239,7 +236,6 @@ dasd_devices_open(struct inode *inode, struct file *file)
MESSAGE(KERN_WARNING, "%s", MESSAGE(KERN_WARNING, "%s",
"No memory available for data (info->data)"); "No memory available for data (info->data)");
kfree(info); kfree(info);
MOD_DEC_USE_COUNT;
return -ENOMEM; return -ENOMEM;
} }
file->private_data = (void *) info; file->private_data = (void *) info;
...@@ -266,6 +262,7 @@ dasd_devices_open(struct inode *inode, struct file *file) ...@@ -266,6 +262,7 @@ dasd_devices_open(struct inode *inode, struct file *file)
} }
static struct file_operations dasd_devices_file_ops = { static struct file_operations dasd_devices_file_ops = {
owner:THIS_MODULE,
read:dasd_generic_read, /* read */ read:dasd_generic_read, /* read */
write:dasd_devices_write, /* write */ write:dasd_devices_write, /* write */
open:dasd_devices_open, /* open */ open:dasd_devices_open, /* open */
...@@ -299,12 +296,10 @@ dasd_statistics_open(struct inode *inode, struct file *file) ...@@ -299,12 +296,10 @@ dasd_statistics_open(struct inode *inode, struct file *file)
int shift; int shift;
#endif #endif
MOD_INC_USE_COUNT;
info = (tempinfo_t *) kmalloc(sizeof (tempinfo_t), GFP_KERNEL); info = (tempinfo_t *) kmalloc(sizeof (tempinfo_t), GFP_KERNEL);
if (info == NULL) { if (info == NULL) {
MESSAGE(KERN_WARNING, "%s", MESSAGE(KERN_WARNING, "%s",
"No memory available for data (tempinfo)"); "No memory available for data (tempinfo)");
MOD_DEC_USE_COUNT;
return -ENOMEM; return -ENOMEM;
} }
...@@ -317,7 +312,6 @@ dasd_statistics_open(struct inode *inode, struct file *file) ...@@ -317,7 +312,6 @@ dasd_statistics_open(struct inode *inode, struct file *file)
"No memory available for data (info->data)"); "No memory available for data (info->data)");
kfree(info); kfree(info);
file->private_data = NULL; file->private_data = NULL;
MOD_DEC_USE_COUNT;
return -ENOMEM; return -ENOMEM;
} }
#ifdef CONFIG_DASD_PROFILE #ifdef CONFIG_DASD_PROFILE
...@@ -422,6 +416,7 @@ dasd_statistics_write(struct file *file, const char *user_buf, ...@@ -422,6 +416,7 @@ dasd_statistics_write(struct file *file, const char *user_buf,
} }
static struct file_operations dasd_statistics_file_ops = { static struct file_operations dasd_statistics_file_ops = {
owner: THIS_MODULE,
read: dasd_generic_read, /* read */ read: dasd_generic_read, /* read */
write: dasd_statistics_write, /* write */ write: dasd_statistics_write, /* write */
open: dasd_statistics_open, /* open */ open: dasd_statistics_open, /* open */
......
...@@ -199,6 +199,7 @@ typedef struct { ...@@ -199,6 +199,7 @@ typedef struct {
static struct file_operations tape_proc_devices_file_ops = static struct file_operations tape_proc_devices_file_ops =
{ {
owner:THIS_MODULE,
read:tape_proc_devices_read, /* read */ read:tape_proc_devices_read, /* read */
open:tape_proc_devices_open, /* open */ open:tape_proc_devices_open, /* open */
release:tape_proc_devices_release, /* close */ release:tape_proc_devices_release, /* close */
...@@ -239,12 +240,9 @@ tape_proc_devices_open (struct inode *inode, struct file *file) ...@@ -239,12 +240,9 @@ tape_proc_devices_open (struct inode *inode, struct file *file)
long lockflags,lockflags2; long lockflags,lockflags2;
tape_ccw_req_t *treq; tape_ccw_req_t *treq;
MOD_INC_USE_COUNT;
procinfo = kmalloc (sizeof(tape_procinfo_t),GFP_KERNEL); procinfo = kmalloc (sizeof(tape_procinfo_t),GFP_KERNEL);
if (!procinfo){ if (!procinfo){
rc = -ENOMEM; rc = -ENOMEM;
MOD_DEC_USE_COUNT;
goto out_no_lock; goto out_no_lock;
} }
...@@ -349,7 +347,6 @@ tape_proc_devices_release (struct inode *inode, struct file *file) ...@@ -349,7 +347,6 @@ tape_proc_devices_release (struct inode *inode, struct file *file)
tape_procinfo_t *p_info = (tape_procinfo_t *) file->private_data; tape_procinfo_t *p_info = (tape_procinfo_t *) file->private_data;
vfree(p_info->data); vfree(p_info->data);
kfree (p_info); kfree (p_info);
MOD_DEC_USE_COUNT;
return rc; return rc;
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
*/ */
static struct file_operations tape_fops = static struct file_operations tape_fops =
{ {
owner:THIS_MODULE,
read:tapechar_read, read:tapechar_read,
write:tapechar_write, write:tapechar_write,
ioctl:tapechar_ioctl, ioctl:tapechar_ioctl,
...@@ -548,8 +549,6 @@ tapechar_open (struct inode *inode, struct file *filp) ...@@ -548,8 +549,6 @@ tapechar_open (struct inode *inode, struct file *filp)
int rc = 0; int rc = 0;
long lockflags; long lockflags;
MOD_INC_USE_COUNT;
tape_sprintf_event (tape_dbf_area,6,"c:open: %x\n",td->first_minor); tape_sprintf_event (tape_dbf_area,6,"c:open: %x\n",td->first_minor);
inode = filp->f_dentry->d_inode; inode = filp->f_dentry->d_inode;
...@@ -580,7 +579,6 @@ tapechar_open (struct inode *inode, struct file *filp) ...@@ -580,7 +579,6 @@ tapechar_open (struct inode *inode, struct file *filp)
s390irq_spin_unlock_irqrestore(td->devinfo.irq,lockflags); s390irq_spin_unlock_irqrestore(td->devinfo.irq,lockflags);
error: error:
if(rc != 0){ if(rc != 0){
MOD_DEC_USE_COUNT;
if (td!=NULL) if (td!=NULL)
tape_put_device(td); tape_put_device(td);
} }
...@@ -625,6 +623,5 @@ tapechar_release (struct inode *inode, struct file *filp) ...@@ -625,6 +623,5 @@ tapechar_release (struct inode *inode, struct file *filp)
if ( td->discipline->owner ) if ( td->discipline->owner )
__MOD_DEC_USE_COUNT(td->discipline->owner); __MOD_DEC_USE_COUNT(td->discipline->owner);
tape_put_device(td); tape_put_device(td);
MOD_DEC_USE_COUNT;
return rc; return rc;
} }
...@@ -403,8 +403,6 @@ open_scanner(struct inode * inode, struct file * file) ...@@ -403,8 +403,6 @@ open_scanner(struct inode * inode, struct file * file)
int err=0; int err=0;
MOD_INC_USE_COUNT;
down(&scn_mutex); down(&scn_mutex);
scn_minor = USB_SCN_MINOR(inode); scn_minor = USB_SCN_MINOR(inode);
...@@ -413,7 +411,6 @@ open_scanner(struct inode * inode, struct file * file) ...@@ -413,7 +411,6 @@ open_scanner(struct inode * inode, struct file * file)
if (!p_scn_table[scn_minor]) { if (!p_scn_table[scn_minor]) {
up(&scn_mutex); up(&scn_mutex);
MOD_DEC_USE_COUNT;
err("open_scanner(%d): Unable to access minor data", scn_minor); err("open_scanner(%d): Unable to access minor data", scn_minor);
return -ENODEV; return -ENODEV;
} }
...@@ -455,9 +452,6 @@ open_scanner(struct inode * inode, struct file * file) ...@@ -455,9 +452,6 @@ open_scanner(struct inode * inode, struct file * file)
up(&(scn->sem)); /* Wake up any possible contending processes */ up(&(scn->sem)); /* Wake up any possible contending processes */
if (err)
MOD_DEC_USE_COUNT;
return err; return err;
} }
...@@ -488,8 +482,6 @@ close_scanner(struct inode * inode, struct file * file) ...@@ -488,8 +482,6 @@ close_scanner(struct inode * inode, struct file * file)
up(&scn_mutex); up(&scn_mutex);
up(&(scn->sem)); up(&(scn->sem));
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -826,6 +818,7 @@ ioctl_scanner(struct inode *inode, struct file *file, ...@@ -826,6 +818,7 @@ ioctl_scanner(struct inode *inode, struct file *file,
static struct static struct
file_operations usb_scanner_fops = { file_operations usb_scanner_fops = {
.owner = THIS_MODULE,
.read = read_scanner, .read = read_scanner,
.write = write_scanner, .write = write_scanner,
.ioctl = ioctl_scanner, .ioctl = ioctl_scanner,
......
...@@ -54,7 +54,11 @@ static int som_core_dump(long signr, struct pt_regs * regs); ...@@ -54,7 +54,11 @@ static int som_core_dump(long signr, struct pt_regs * regs);
#define SOM_PAGEALIGN(_v) (((_v) + SOM_PAGESIZE - 1) & ~(SOM_PAGESIZE - 1)) #define SOM_PAGEALIGN(_v) (((_v) + SOM_PAGESIZE - 1) & ~(SOM_PAGESIZE - 1))
static struct linux_binfmt som_format = { static struct linux_binfmt som_format = {
NULL, THIS_MODULE, load_som_binary, load_som_library, som_core_dump, SOM_PAGESIZE .module = THIS_MODULE,
.load_binary = load_som_binary,
.load_library = load_som_library,
.core_dump = som_core_dump,
.min_coredump = SOM_PAGESIZE
}; };
/* /*
...@@ -182,8 +186,8 @@ static int map_som_binary(struct file *file, ...@@ -182,8 +186,8 @@ static int map_som_binary(struct file *file,
* libraries. There is no binary dependent code anywhere else. * libraries. There is no binary dependent code anywhere else.
*/ */
static inline int static int
do_load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs) load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
{ {
int som_exec_fileno; int som_exec_fileno;
int retval; int retval;
...@@ -280,34 +284,11 @@ do_load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -280,34 +284,11 @@ do_load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
return retval; return retval;
} }
static int static int load_som_library(struct file *f)
load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
{
int retval;
MOD_INC_USE_COUNT;
retval = do_load_som_binary(bprm, regs);
MOD_DEC_USE_COUNT;
return retval;
}
static inline int
do_load_som_library(struct file *f)
{ {
/* No lib support in SOM yet. gizza chance.. */ /* No lib support in SOM yet. gizza chance.. */
return -ENOEXEC; return -ENOEXEC;
} }
static int load_som_library(struct file *f)
{
int retval;
MOD_INC_USE_COUNT;
retval = do_load_som_library(f);
MOD_DEC_USE_COUNT;
return retval;
}
/* Install the SOM loader. /* Install the SOM loader.
* N.B. We *rely* on the table being the right size with the * N.B. We *rely* on the table being the right size with the
* right number of free slots... * right number of free slots...
...@@ -326,4 +307,3 @@ static void __exit exit_som_binfmt(void) ...@@ -326,4 +307,3 @@ static void __exit exit_som_binfmt(void)
module_init(init_som_binfmt); module_init(init_som_binfmt);
module_exit(exit_som_binfmt); module_exit(exit_som_binfmt);
...@@ -311,8 +311,6 @@ static int presto_psdev_open(struct inode * inode, struct file * file) ...@@ -311,8 +311,6 @@ static int presto_psdev_open(struct inode * inode, struct file * file)
file->private_data = NULL; file->private_data = NULL;
MOD_INC_USE_COUNT;
CDEBUG(D_PSDEV, "Psdev_open: caller: %d, flags: %d\n", current->pid, file->f_flags); CDEBUG(D_PSDEV, "Psdev_open: caller: %d, flags: %d\n", current->pid, file->f_flags);
EXIT; EXIT;
...@@ -333,7 +331,6 @@ static int presto_psdev_release(struct inode * inode, struct file * file) ...@@ -333,7 +331,6 @@ static int presto_psdev_release(struct inode * inode, struct file * file)
return -EBADF; return -EBADF;
} }
MOD_DEC_USE_COUNT;
CDEBUG(D_PSDEV, "Lento: pid %d\n", current->pid); CDEBUG(D_PSDEV, "Lento: pid %d\n", current->pid);
channel->uc_pid = 0; channel->uc_pid = 0;
...@@ -369,6 +366,7 @@ static int presto_psdev_release(struct inode * inode, struct file * file) ...@@ -369,6 +366,7 @@ static int presto_psdev_release(struct inode * inode, struct file * file)
} }
static struct file_operations presto_psdev_fops = { static struct file_operations presto_psdev_fops = {
.owner = THIS_MODULE,
.read = presto_psdev_read, .read = presto_psdev_read,
.write = presto_psdev_write, .write = presto_psdev_write,
.poll = presto_psdev_poll, .poll = presto_psdev_poll,
......
...@@ -246,14 +246,11 @@ struct super_block * presto_get_sb(struct file_system_type *izo_type, ...@@ -246,14 +246,11 @@ struct super_block * presto_get_sb(struct file_system_type *izo_type,
CDEBUG(D_SUPER, "Presto: type=%s, fset=%s, dev= %d, flags %x\n", CDEBUG(D_SUPER, "Presto: type=%s, fset=%s, dev= %d, flags %x\n",
cache_type, fileset?fileset:"NULL", minor, cache->cache_flags); cache_type, fileset?fileset:"NULL", minor, cache->cache_flags);
MOD_INC_USE_COUNT;
/* get the filter for the cache */ /* get the filter for the cache */
fstype = get_fs_type(cache_type); fstype = get_fs_type(cache_type);
cache->cache_filter = filter_get_filter_fs((const char *)cache_type); cache->cache_filter = filter_get_filter_fs((const char *)cache_type);
if ( !fstype || !cache->cache_filter) { if ( !fstype || !cache->cache_filter) {
CERROR("Presto: unrecognized fs type or cache type\n"); CERROR("Presto: unrecognized fs type or cache type\n");
MOD_DEC_USE_COUNT;
EXIT; EXIT;
goto out_err; goto out_err;
} }
...@@ -262,7 +259,6 @@ struct super_block * presto_get_sb(struct file_system_type *izo_type, ...@@ -262,7 +259,6 @@ struct super_block * presto_get_sb(struct file_system_type *izo_type,
if ( !sb || IS_ERR(sb)) { if ( !sb || IS_ERR(sb)) {
CERROR("InterMezzo: cache mount failure.\n"); CERROR("InterMezzo: cache mount failure.\n");
MOD_DEC_USE_COUNT;
EXIT; EXIT;
goto out_err; goto out_err;
} }
...@@ -270,7 +266,6 @@ struct super_block * presto_get_sb(struct file_system_type *izo_type, ...@@ -270,7 +266,6 @@ struct super_block * presto_get_sb(struct file_system_type *izo_type,
/* can we in fact mount the cache */ /* can we in fact mount the cache */
if (sb->s_bdev && (strcmp(fstype->name, "vintermezzo") == 0)) { if (sb->s_bdev && (strcmp(fstype->name, "vintermezzo") == 0)) {
CERROR("vintermezzo must not be used with a block device\n"); CERROR("vintermezzo must not be used with a block device\n");
MOD_DEC_USE_COUNT;
EXIT; EXIT;
goto out_err; goto out_err;
} }
......
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