Linux EDAC development
 help / color / mirror / Atom feed
* [PATCH v2] EDAC/igen6: Fix error handling in igen6_edac driver
@ 2025-11-05  9:02 Ma Ke
  2025-11-05 12:27 ` Zhuo, Qiuxu
  2025-11-20 16:49 ` Luck, Tony
  0 siblings, 2 replies; 3+ messages in thread
From: Ma Ke @ 2025-11-05  9:02 UTC (permalink / raw)
  To: tony.luck, qiuxu.zhuo, bp; +Cc: linux-edac, linux-kernel, akpm, 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.

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] EDAC/igen6: Fix error handling in igen6_edac driver
  2025-11-05  9:02 [PATCH v2] EDAC/igen6: Fix error handling in igen6_edac driver Ma Ke
@ 2025-11-05 12:27 ` Zhuo, Qiuxu
  2025-11-20 16:49 ` Luck, Tony
  1 sibling, 0 replies; 3+ messages in thread
From: Zhuo, Qiuxu @ 2025-11-05 12:27 UTC (permalink / raw)
  To: Ma Ke, Luck, Tony, bp@alien8.de
  Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org

> 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.
> [...]


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] EDAC/igen6: Fix error handling in igen6_edac driver
  2025-11-05  9:02 [PATCH v2] EDAC/igen6: Fix error handling in igen6_edac driver Ma Ke
  2025-11-05 12:27 ` Zhuo, Qiuxu
@ 2025-11-20 16:49 ` Luck, Tony
  1 sibling, 0 replies; 3+ messages in thread
From: Luck, Tony @ 2025-11-20 16:49 UTC (permalink / raw)
  To: Ma Ke; +Cc: qiuxu.zhuo, bp, linux-edac, linux-kernel, akpm

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-20 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05  9:02 [PATCH v2] EDAC/igen6: Fix error handling in igen6_edac driver Ma Ke
2025-11-05 12:27 ` Zhuo, Qiuxu
2025-11-20 16:49 ` Luck, Tony

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox