[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251105090244.23327-1-make24@iscas.ac.cn>
Date: Wed, 5 Nov 2025 17:02:44 +0800
From: Ma Ke <make24@...as.ac.cn>
To: tony.luck@...el.com,
qiuxu.zhuo@...el.com,
bp@...en8.de
Cc: linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org,
Ma Ke <make24@...as.ac.cn>
Subject: [PATCH v2] EDAC/igen6: Fix error handling in igen6_edac driver
The igen6_edac driver calls device_initialize() for all memory
controllers in igen6_register_mci(), but misses corresponding
put_device() calls in error paths and during normal shutdown in
igen6_unregister_mcis().
Adding the missing put_device() calls improves code readability and
ensures proper reference counting for the device structure.
Found by code review.
Signed-off-by: Ma Ke <make24@...as.ac.cn>
---
Changes in v2:
- modified the patch, thanks for developer's suggestions;
- removed Fixes line.
---
drivers/edac/igen6_edac.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c
index 2fc59f9eed69..553c31a2d922 100644
--- a/drivers/edac/igen6_edac.c
+++ b/drivers/edac/igen6_edac.c
@@ -1300,6 +1300,7 @@ static int igen6_register_mci(int mc, void __iomem *window, struct pci_dev *pdev
imc->mci = mci;
return 0;
fail3:
+ put_device(&imc->dev);
mci->pvt_info = NULL;
kfree(mci->ctl_name);
fail2:
@@ -1326,6 +1327,7 @@ static void igen6_unregister_mcis(void)
kfree(mci->ctl_name);
mci->pvt_info = NULL;
edac_mc_free(mci);
+ put_device(&imc->dev);
iounmap(imc->window);
}
}
--
2.17.1
Powered by blists - more mailing lists