RE: [PATCH] cxl: avoid returning uninitialized error code
From: Dan Williams
Date: Tue Feb 14 2023 - 11:36:24 EST
Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> The new cxl_add_to_region() function returns an uninitialized
> value on success:
>
> drivers/cxl/core/region.c:2628:6: error: variable 'rc' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> if (IS_ERR(cxlr)) {
> ^~~~~~~~~~~~
> drivers/cxl/core/region.c:2654:9: note: uninitialized use occurs here
> return rc;
>
> Simplify the logic to have the rc variable always initialized in the
> same place.
>
> Fixes: a32320b71f08 ("cxl/region: Add region autodiscovery")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Looks good, thanks Arnd.