EDAC/igen6: Fix error handling in igen6_edac driver
Subsystems (2)
PATCH v2 1/1 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.
---
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(+)
drivers/edac/igen6_edac.c +2 -0
@@ -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); } }
Signature · 1 line
2.17.1
Quoted 13 lines
From: Ma Ke <[email protected]>
Sent: Wednesday, November 5, 2025 5:03 PM
To: Luck, Tony <[email protected]>; Zhuo, Qiuxu <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; Ma Ke <[email protected]>
Subject: [PATCH v2] EDAC/igen6: Fix error handling inigen6_edacdriverThe
igen6_edacdriver callsdevice_initialize()for all memory controllers inigen6_register_mci(), but misses correspondingput_device()calls in error paths and during normal shutdown inigen6_unregister_mcis().
Quoted 6 lines
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 <[email protected]>
LGTM, thanks.
Quoted 5 lines
---
Changes in v2:
- modified the patch, thanks for developer's suggestions;
- removed Fixes line.
[...]
Quoted 11 lines · Ma Ke
The
igen6_edacdriver callsdevice_initialize()for all memory controllers inigen6_register_mci(), but misses correspondingput_device()calls in error paths and during normal shutdown inigen6_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 <[email protected]>
Applied. Thanks.
-Tony