From: Juan Zhou zhoujuan51@h-partners.com
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8OLBT
--------------------------------------------------------------------------
In the init_poe_ch_debugfs() function, the variable dbgfs can be directly read without applying for additional memory. Otherwise, memory leakage may occur.
Fixes: b6643496e2b4 ("RDMA/hns: Refactor hns RoCE debugfs") Signed-off-by: Juan Zhou zhoujuan51@h-partners.com Signed-off-by: Junxian Huang huangjunxian6@hisilicon.com --- drivers/infiniband/hw/hns/hns_roce_debugfs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_debugfs.c b/drivers/infiniband/hw/hns/hns_roce_debugfs.c index d42bea711507..9d3075ee0d22 100644 --- a/drivers/infiniband/hw/hns/hns_roce_debugfs.c +++ b/drivers/infiniband/hw/hns/hns_roce_debugfs.c @@ -557,14 +557,10 @@ static void init_poe_ch_debugfs(struct hns_roce_dev *hr_dev, uint8_t index, struct dentry *parent) { #define POE_CH_NAME_LEN 10 + struct hns_poe_ch_debugfs *dbgfs = &hr_dev->dbgfs.poe_root.poe_ch[index]; struct hns_roce_poe_ch *poe_ch = &hr_dev->poe_ctx.poe_ch[index]; - struct hns_poe_ch_debugfs *dbgfs; char name[POE_CH_NAME_LEN];
- dbgfs = kvzalloc(sizeof(*dbgfs), GFP_KERNEL); - if (!dbgfs) - return; - snprintf(name, sizeof(name), "poe_%u", index); dbgfs->root = debugfs_create_dir(name, parent);