drivers/edac/igen6_edac.c | 2 ++ 1 file changed, 2 insertions(+)
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@iscas.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
On Wed, Nov 05, 2025 at 05:02:44PM +0800, Ma Ke wrote: > 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@iscas.ac.cn> Applied. Thanks. -Tony
> From: Ma Ke <make24@iscas.ac.cn> > Sent: Wednesday, November 5, 2025 5:03 PM > To: Luck, Tony <tony.luck@intel.com>; Zhuo, Qiuxu <qiuxu.zhuo@intel.com>; > bp@alien8.de > Cc: linux-edac@vger.kernel.org; linux-kernel@vger.kernel.org; akpm@linux- > foundation.org; Ma Ke <make24@iscas.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@iscas.ac.cn> LGTM, thanks. Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> > --- > Changes in v2: > - modified the patch, thanks for developer's suggestions; > - removed Fixes line. > [...]
© 2016 - 2025 Red Hat, Inc.