Skip to content

Commit 8b82f65

Browse files
nifeykuba-moo
authored andcommitted
pds_core: fix memory leak in pdsc_debugfs_add_qcq()
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: 45d76f4 ("pds_core: set up device and adminq") Signed-off-by: Abdun Nihaal <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e861041 commit 8b82f65

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/ethernet/amd/pds_core/debugfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
154154
debugfs_create_u32("index", 0400, intr_dentry, &intr->index);
155155
debugfs_create_u32("vector", 0400, intr_dentry, &intr->vector);
156156

157-
intr_ctrl_regset = kzalloc(sizeof(*intr_ctrl_regset),
158-
GFP_KERNEL);
157+
intr_ctrl_regset = devm_kzalloc(pdsc->dev,
158+
sizeof(*intr_ctrl_regset),
159+
GFP_KERNEL);
159160
if (!intr_ctrl_regset)
160161
return;
161162
intr_ctrl_regset->regs = intr_ctrl_regs;

0 commit comments

Comments
 (0)