linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Chen Jiahao <chenjiahao16@huawei.com>
Cc: conor.dooley@microchip.com, daire.mcnamara@microchip.com,
	broonie@kernel.org, linux-riscv@lists.infradead.org,
	linux-spi@vger.kernel.org
Subject: Re: [PATCH -next] spi: microchip-core: Clean up redundant dev_err_probe()
Date: Thu, 27 Jul 2023 14:34:56 +0100	[thread overview]
Message-ID: <20230727-curvature-register-6eb0a2c60a8b@spud> (raw)
In-Reply-To: <20230727130049.2810959-1-chenjiahao16@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]

On Thu, Jul 27, 2023 at 09:00:49PM +0800, Chen Jiahao wrote:
> Refering to platform_get_irq()'s definition, the return value has
> already been checked if ret < 0, and printed via dev_err_probe().
> Calling dev_err_probe() one more time outside platform_get_irq()
> is obviously redundant.
> 
> Furthermore, platform_get_irq() will never return irq equals 0,
> removing spi->irq == 0 checking to clean it up.
> 
> Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com>
> ---
>  drivers/spi/spi-microchip-core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi-microchip-core.c b/drivers/spi/spi-microchip-core.c
> index b59e8a0c5b97..ac3b7b163db4 100644
> --- a/drivers/spi/spi-microchip-core.c
> +++ b/drivers/spi/spi-microchip-core.c
> @@ -530,10 +530,8 @@ static int mchp_corespi_probe(struct platform_device *pdev)
>  		return PTR_ERR(spi->regs);
>  
>  	spi->irq = platform_get_irq(pdev, 0);
> -	if (spi->irq <= 0)
> -		return dev_err_probe(&pdev->dev, -ENXIO,
> -				     "invalid IRQ %d for SPI controller\n",
> -				     spi->irq);
> +	if (spi->irq < 0)
> +		return -ENXIO;

platform_get_irq() returns an ERRNO that can now be propagated since
the special case for 0 no longer requires handling, no?

>  
>  	ret = devm_request_irq(&pdev->dev, spi->irq, mchp_corespi_interrupt,
>  			       IRQF_SHARED, dev_name(&pdev->dev), master);
> -- 
> 2.34.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-07-27 13:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 13:00 [PATCH -next] spi: microchip-core: Clean up redundant dev_err_probe() Chen Jiahao
2023-07-27 13:34 ` Conor Dooley [this message]
2023-07-28  7:42   ` chenjiahao (C)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230727-curvature-register-6eb0a2c60a8b@spud \
    --to=conor@kernel.org \
    --cc=broonie@kernel.org \
    --cc=chenjiahao16@huawei.com \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).