Re: [PATCH v1 1/1] spi: Don't overwrite num_chipselect with error code

From: Andy Shevchenko
Date: Tue Apr 20 2021 - 10:33:33 EST

On Tue, Apr 20, 2021 at 4:19 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> The code currently organized in a way that num_chipselect is overwritten
> each time we call spi_get_gpio_descs(). It might be potentially dangerous
> in case when the gpiod_count() returns an error code.
> Note, that gpiod_count() never returns 0, take this into account as well.
> Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")

It doesn't fix anything. I missed the max_t(int).
In any case it makes error handling cleaner, so I'll reformulate the
commit message in v2 and drop Fixes tag.

With Best Regards,
Andy Shevchenko