Skip to content

Commit 09fbca8

Browse files
Dennis Dalessandrojgunthorpe
authored andcommitted
IB/hfi1: No need to use try_module_get for debugfs
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 <[email protected]> Reviewed-by: Mike Marciniszyn <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 8bd516b commit 09fbca8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/infiniband/hw/hfi1/debugfs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,9 +987,6 @@ static int __i2c_debugfs_open(struct inode *in, struct file *fp, u32 target)
987987
struct hfi1_pportdata *ppd;
988988
int ret;
989989

990-
if (!try_module_get(THIS_MODULE))
991-
return -ENODEV;
992-
993990
ppd = private2ppd(fp);
994991

995992
ret = acquire_chip_resource(ppd->dd, i2c_target(target), 0);
@@ -1155,6 +1152,7 @@ static int exprom_wp_debugfs_release(struct inode *in, struct file *fp)
11551152
{ \
11561153
.name = nm, \
11571154
.ops = { \
1155+
.owner = THIS_MODULE, \
11581156
.read = readroutine, \
11591157
.write = writeroutine, \
11601158
.llseek = generic_file_llseek, \
@@ -1165,6 +1163,7 @@ static int exprom_wp_debugfs_release(struct inode *in, struct file *fp)
11651163
{ \
11661164
.name = nm, \
11671165
.ops = { \
1166+
.owner = THIS_MODULE, \
11681167
.read = readf, \
11691168
.write = writef, \
11701169
.llseek = generic_file_llseek, \

0 commit comments

Comments
 (0)