Re: [PATCH] [mfd] da9052: Add error handling for spi_setup in da9052_spi_probe

From: Geert Uytterhoeven
Date: Tue Dec 05 2023 - 06:34:22 EST


On Sun, Dec 3, 2023 at 6:22 AM Haoran Liu <liuhaoran14@xxxxxxx> wrote:
> This patch adds error handling for the spi_setup call. The need for this
> error handling was identified through static analysis, which highlighted
> the lack of proper handling for potential failures of spi_setup.
> Previously, a failure in spi_setup could lead to unstable behavior of
> the DA9052 device.
>
> Although the error addressed by this patch may not occur in the current
> environment, I still suggest implementing these error handling routines
> if the function is not highly time-sensitive. As the environment evolves
> or the code gets reused in different contexts, there's a possibility that
> these errors might occur. In case you find this addition unnecessary, I
> completely understand and respect your perspective. My intention was to
> enhance the robustness of the code, but I acknowledge that practical
> considerations and current functionality might not warrant this change
> at this point.
>
> Signed-off-by: Haoran Liu <liuhaoran14@xxxxxxx>
> ---
> drivers/mfd/da9052-spi.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
> index be5f2b34e18a..c32d5025a18f 100644
> --- a/drivers/mfd/da9052-spi.c
> +++ b/drivers/mfd/da9052-spi.c
> @@ -22,6 +22,7 @@ static int da9052_spi_probe(struct spi_device *spi)
> int ret;
> const struct spi_device_id *id = spi_get_device_id(spi);
> struct da9052 *da9052;
> + int ret;

As reported by the kernel test robot:

error: redeclaration of 'ret' with no linkage

your patch fails to build (again!).

Please stop submitting completely untested patches.
Thank you!

Gr{oetje,eeting}s,

Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds