diff mbox series

[-next] spi: at91-usart: Use PTR_ERR_OR_ZERO() to simplify code

Message ID 20230822124643.987079-1-ruanjinjie@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] spi: at91-usart: Use PTR_ERR_OR_ZERO() to simplify code | expand

Commit Message

Jinjie Ruan Aug. 22, 2023, 12:46 p.m. UTC
Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
simplify code.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/spi/spi-at91-usart.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Nicolas Ferre Aug. 22, 2023, 1:11 p.m. UTC | #1
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@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
>
Mark Brown Aug. 22, 2023, 2:15 p.m. UTC | #2
On Tue, Aug 22, 2023 at 03:11:01PM +0200, Nicolas Ferre wrote:

> Do we really need these changes?... oh well, no strong opinion but is it
> worth the effort?

I tend to go on the basis that for this sort of thing that's recognised
by pattern matching other people will end up sending versions of it no
matter what.
Alexandre Belloni Aug. 22, 2023, 2:45 p.m. UTC | #3
On 22/08/2023 15:15:13+0100, Mark Brown wrote:
> On Tue, Aug 22, 2023 at 03:11:01PM +0200, Nicolas Ferre wrote:
> 
> > Do we really need these changes?... oh well, no strong opinion but is it
> > worth the effort?
> 
> I tend to go on the basis that for this sort of thing that's recognised
> by pattern matching other people will end up sending versions of it no
> matter what.

And I'd love for people to explicitly write this has been automatically
generated in their commit log so we know that probably no though has
been given to the patch.
Mark Brown Aug. 22, 2023, 3:04 p.m. UTC | #4
On Tue, Aug 22, 2023 at 04:45:55PM +0200, Alexandre Belloni wrote:
> On 22/08/2023 15:15:13+0100, Mark Brown wrote:

> > I tend to go on the basis that for this sort of thing that's recognised
> > by pattern matching other people will end up sending versions of it no
> > matter what.

> And I'd love for people to explicitly write this has been automatically
> generated in their commit log so we know that probably no though has
> been given to the patch.

Well, a bunch of them are going to be manually written by someone based
on fixing warnings that some checker is generating rather than actually
automatically generated.
Mark Brown Aug. 22, 2023, 4:33 p.m. UTC | #5
On Tue, 22 Aug 2023 20:46:42 +0800, Jinjie Ruan wrote:
> Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
> simplify code.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: at91-usart: Use PTR_ERR_OR_ZERO() to simplify code
      commit: 60ea3db33fbddf559e18567ca8897f6bb9f25290

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

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)