Hi Ma Ke,
Thanks for this report.
From: Ma Ke make24@iscas.ac.cn Sent: Tuesday, November 4, 2025 9:23 AM To: jbaron@akamai.com; bp@alien8.de; Luck, Tony tony.luck@intel.com; Zhuo, Qiuxu qiuxu.zhuo@intel.com Cc: linux-edac@vger.kernel.org; linux-kernel@vger.kernel.org; akpm@linux- foundation.org; Ma Ke make24@iscas.ac.cn; stable@vger.kernel.org Subject: [PATCH] EDAC/ie31200: Fix error handling in ie31200_register_mci
When mc > 0, ie31200_register_mci() initializes priv->dev but fails to call put_device() on it in the error path, causing a memory leak. Add proper
edac_mc_free() triggers mci_release(), which eventually frees mci->pvt_info, so there are no memory leaks, and put_device() is NOT needed.
put_device() call for priv->dev in the error handling path to balance device_initialize().
From the perspective of pairing with device_initialize() for better code readability, then we may add put_device().
Found by code review.
Cc: stable@vger.kernel.org Fixes: d0742284ec6d ("EDAC/ie31200: Add Intel Raptor Lake-S SoCs support")
This is not a real bug. No "Fixes" tag needed to avoid unnecessary backporting.
Signed-off-by: Ma Ke make24@iscas.ac.cn
drivers/edac/ie31200_edac.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/edac/ie31200_edac.c b/drivers/edac/ie31200_edac.c index 5a080ab65476..a5a4bb24b72a 100644 --- a/drivers/edac/ie31200_edac.c +++ b/drivers/edac/ie31200_edac.c @@ -528,6 +528,8 @@ static int ie31200_register_mci(struct pci_dev *pdev, struct res_config *cfg, in fail_unmap: iounmap(window); fail_free:
- if (mc > 0)
Since both primary and secondary memory controllers invoke device_initialize(), please remove this "if (mc > 0)" check to call put_device() unconditionally here.
edac_mc_free(mci); return ret;put_device(&priv->dev);}
Could you please address the comments above, update the commit messages, and send v2?
Thanks! -Qiuxu