Skip to content

Commit 822fbd3

Browse files
Dennis Dalessandrojgunthorpe
authored andcommitted
IB/hfi1: Fix module use count flaw due to leftover module put calls
When the try_module_get calls were removed from opening and closing of the i2c debugfs file, the corresponding module_put calls were missed. This results in an inaccurate module use count that requires a power cycle to fix. Fixes: 09fbca8 ("IB/hfi1: No need to use try_module_get for debugfs") Link: https://lore.kernel.org/r/20200623203230.106975.76240.stgit@awfm-01.aw.intel.com Cc: <stable@vger.kernel.org> Reviewed-by: Kaike Wan <kaike.wan@intel.com> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent b46925a commit 822fbd3

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

‎drivers/infiniband/hw/hfi1/debugfs.c‎

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -985,15 +985,10 @@ static ssize_t qsfp2_debugfs_read(struct file *file, char __user *buf,
985985
static int __i2c_debugfs_open(struct inode *in, struct file *fp, u32 target)
986986
{
987987
struct hfi1_pportdata *ppd;
988-
int ret;
989988

990989
ppd = private2ppd(fp);
991990

992-
ret = acquire_chip_resource(ppd->dd, i2c_target(target), 0);
993-
if (ret) /* failed - release the module */
994-
module_put(THIS_MODULE);
995-
996-
return ret;
991+
return acquire_chip_resource(ppd->dd, i2c_target(target), 0);
997992
}
998993

999994
static int i2c1_debugfs_open(struct inode *in, struct file *fp)
@@ -1013,7 +1008,6 @@ static int __i2c_debugfs_release(struct inode *in, struct file *fp, u32 target)
10131008
ppd = private2ppd(fp);
10141009

10151010
release_chip_resource(ppd->dd, i2c_target(target));
1016-
module_put(THIS_MODULE);
10171011

10181012
return 0;
10191013
}
@@ -1031,18 +1025,10 @@ static int i2c2_debugfs_release(struct inode *in, struct file *fp)
10311025
static int __qsfp_debugfs_open(struct inode *in, struct file *fp, u32 target)
10321026
{
10331027
struct hfi1_pportdata *ppd;
1034-
int ret;
1035-
1036-
if (!try_module_get(THIS_MODULE))
1037-
return -ENODEV;
10381028

10391029
ppd = private2ppd(fp);
10401030

1041-
ret = acquire_chip_resource(ppd->dd, i2c_target(target), 0);
1042-
if (ret) /* failed - release the module */
1043-
module_put(THIS_MODULE);
1044-
1045-
return ret;
1031+
return acquire_chip_resource(ppd->dd, i2c_target(target), 0);
10461032
}
10471033

10481034
static int qsfp1_debugfs_open(struct inode *in, struct file *fp)
@@ -1062,7 +1048,6 @@ static int __qsfp_debugfs_release(struct inode *in, struct file *fp, u32 target)
10621048
ppd = private2ppd(fp);
10631049

10641050
release_chip_resource(ppd->dd, i2c_target(target));
1065-
module_put(THIS_MODULE);
10661051

10671052
return 0;
10681053
}

0 commit comments

Comments
 (0)