Skip to contentSkip to conversation

EDAC/igen6: Fix error handling in igen6_edac driver

PATCH Applied Ma Ke 3 participants 3 messages Nov 5, 2025 – Nov 20, 2025

Subsystems (2)
lore
Share & tools
lore

Ma Ke

author
#0 lore raw

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
index 2fc59f9eed69..553c31a2d922 100644
@@ -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
Reviewed-by on v2 1/1
#1 lore raw
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 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().

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.

LGTM, thanks.

Quoted 5 lines

---
Changes in v2:
- modified the patch, thanks for developer's suggestions;
- removed Fixes line.
[...]

maintainer Applied
#2 lore raw
In reply to Ma Ke
Quoted 11 lines · Ma Ke

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.

Applied. Thanks.

-Tony