Re: [PATCH v2 01/12] EDAC/versalnet: Fix device_register() error handling in init_one_mc()
From: Borislav Petkov
Date: Mon Nov 23 2026 - 20:56:43 EST
On Wed, Nov 18, 2026 at 07:50:25PM +0530, Shubhrajyoti Datta wrote:
> From: Prasanna Kumar T S M <ptsm@xxxxxxxxxxxxxxxxxxx>
>
> When device_register() fails, it must be followed by put_device()
> rather than kfree(), because device_register() calls
> device_initialize() which sets up the device refcount. The matching
> release function versal_edac_release() handles the actual kfree().
>
> To simplify error handling and avoid complex unwinding, split
> device_register() into device_initialize() and device_add().
> Initialize the device early so put_device() can be used in all
> error paths.
>
> Fixes: d5fe2fec6c40 ("EDAC: Add a driver for the AMD Versal NET DDR controller")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Prasanna Kumar T S M <ptsm@xxxxxxxxxxxxxxxxxxx>
> Co-developed-by: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxx>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxx>
> ---
>
> Changes in v2:
> Add the codeveloped tag and remove the non standard signature
> fix the name stack warning
>
> drivers/edac/versalnet_edac.c | 36 +++++++++++++++++------------------
> 1 file changed, 18 insertions(+), 18 deletions(-)
Applied, thanks.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette