RE: [PATCH v2] EDAC/ie31200: Fix error handling in ie31200_register_mci
From: Zhuo, Qiuxu
Date: Tue Nov 04 2025 - 22:23:52 EST
> From: Ma Ke <make24@xxxxxxxxxxx>
> Sent: Wednesday, November 5, 2025 10:22 AM
> To: jbaron@xxxxxxxxxx; bp@xxxxxxxxx; Luck, Tony <tony.luck@xxxxxxxxx>;
> Zhuo, Qiuxu <qiuxu.zhuo@xxxxxxxxx>
> Cc: linux-edac@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; akpm@linux-
> foundation.org; Ma Ke <make24@xxxxxxxxxxx>
> Subject: [PATCH v2] EDAC/ie31200: Fix error handling in ie31200_register_mci
>
> ie31200_register_mci() calls device_initialize() for priv->dev unconditionally.
> However, in the error path, put_device() is not called, leading to an
> imbalance. Similarly, in the unload path,
> put_device() is missing.
>
> Although edac_mc_free() eventually frees the memory, it does not release the
> device initialized by device_initialize(). For code readability and proper pairing
> of device_initialize()/put_device(), add put_device() calls in both error and
> unload paths.
>
> Found by code review.
>
> Signed-off-by: Ma Ke <make24@xxxxxxxxxxx>
LGTM, thanks.
Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>