[PATCH -next] spi: at91-usart: Use PTR_ERR_OR_ZERO() to simplify code
Nicolas Ferre
nicolas.ferre at microchip.com
Tue Aug 22 06:11:01 PDT 2023
On 22/08/2023 at 14:46, Jinjie Ruan wrote:
> Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
> simplify code.
>
> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>
Do we really need these changes?... oh well, no strong opinion but is it
worth the effort?
Regards,
Nicolas
> ---
> drivers/spi/spi-at91-usart.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c
> index 75d9bc606442..b11d0f993cc7 100644
> --- a/drivers/spi/spi-at91-usart.c
> +++ b/drivers/spi/spi-at91-usart.c
> @@ -485,10 +485,7 @@ static int at91_usart_gpio_setup(struct platform_device *pdev)
>
> cs_gpios = devm_gpiod_get_array_optional(&pdev->dev, "cs", GPIOD_OUT_LOW);
>
> - if (IS_ERR(cs_gpios))
> - return PTR_ERR(cs_gpios);
> -
> - return 0;
> + return PTR_ERR_OR_ZERO(cs_gpios);
> }
>
> static int at91_usart_spi_probe(struct platform_device *pdev)
> --
> 2.34.1
>
More information about the linux-arm-kernel
mailing list