Re: [bug report] EDAC: Add a driver for the AMD Versal NET DDR controller
From: Borislav Petkov
Date: Thu Sep 18 2025 - 06:09:40 EST
On Thu, Sep 18, 2025 at 09:55:52AM +0300, Dan Carpenter wrote:
> Hello Shubhrajyoti Datta,
>
> Commit d5fe2fec6c40 ("EDAC: Add a driver for the AMD Versal NET DDR
> controller") from Sep 8, 2025 (linux-next), leads to the following
> Smatch static checker warning:
>
> drivers/edac/versalnet_edac.c:849 init_versalnet()
> warn: '_res' from device_register() not released on lines: 849.
_res?
No _res there.
In any case, this mess is probably due to me trying to salvage a crap
situation already.
The proper fix is carving out the loop body into a __init_versalnet_mc() or so
function which does the allocation and everything along with goto labels for
error path for a *single* memory controller.
And then add another function which unwinds and frees everything, perhaps
__free_versalnet_mc().
Then this init_versalnet() function would only run the loop and call the
__init one. If the __init one returns an error, it would do the unwinding
using the __free one.
Sounds like a plan?
Would you like to give it a try and run your tool ontop to verify?
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette