pds_core: fix memory leak in pdsc_debugfs_add_qcq()

[ Upstream commit 8b82f656826c741d032490b089a5638c33f2c91d ]

The memory allocated for intr_ctrl_regset, which is passed to
debugfs_create_regset32() may not be cleaned up when the driver is
removed. Fix that by using device managed allocation for it.

Fixes: 45d76f4929 ("pds_core: set up device and adminq")
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Link: https://patch.msgid.link/20250409054450.48606-1-abdun.nihaal@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Abdun Nihaal
2025-04-09 11:14:48 +05:30
committed by Greg Kroah-Hartman
parent 86dc3a05fa
commit 9027e07356

View File

@@ -154,8 +154,9 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
debugfs_create_u32("index", 0400, intr_dentry, &intr->index); debugfs_create_u32("index", 0400, intr_dentry, &intr->index);
debugfs_create_u32("vector", 0400, intr_dentry, &intr->vector); debugfs_create_u32("vector", 0400, intr_dentry, &intr->vector);
intr_ctrl_regset = kzalloc(sizeof(*intr_ctrl_regset), intr_ctrl_regset = devm_kzalloc(pdsc->dev,
GFP_KERNEL); sizeof(*intr_ctrl_regset),
GFP_KERNEL);
if (!intr_ctrl_regset) if (!intr_ctrl_regset)
return; return;
intr_ctrl_regset->regs = intr_ctrl_regs; intr_ctrl_regset->regs = intr_ctrl_regs;