Skip to content

Commit

Permalink
IB/hfi1: No need to use try_module_get for debugfs
Browse files Browse the repository at this point in the history
The call in debugfs.c for try_module_get() is not needed. A reference to
the module will be taken by the VFS layer as long as the owner field is
set in the file ops struct. So set this as well as remove the call.

Suggested-by: Jason Gunthorpe <jgg@mellanox.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Dennis Dalessandro authored and Jason Gunthorpe committed Jun 29, 2019
1 parent 8bd516b commit 09fbca8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/infiniband/hw/hfi1/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,6 @@ static int __i2c_debugfs_open(struct inode *in, struct file *fp, u32 target)
struct hfi1_pportdata *ppd;
int ret;

if (!try_module_get(THIS_MODULE))
return -ENODEV;

ppd = private2ppd(fp);

ret = acquire_chip_resource(ppd->dd, i2c_target(target), 0);
Expand Down Expand Up @@ -1155,6 +1152,7 @@ static int exprom_wp_debugfs_release(struct inode *in, struct file *fp)
{ \
.name = nm, \
.ops = { \
.owner = THIS_MODULE, \
.read = readroutine, \
.write = writeroutine, \
.llseek = generic_file_llseek, \
Expand All @@ -1165,6 +1163,7 @@ static int exprom_wp_debugfs_release(struct inode *in, struct file *fp)
{ \
.name = nm, \
.ops = { \
.owner = THIS_MODULE, \
.read = readf, \
.write = writef, \
.llseek = generic_file_llseek, \
Expand Down

0 comments on commit 09fbca8

Please sign in to comment.