From: "chenjiahao (C)" <chenjiahao16@huawei.com>
To: Conor Dooley <conor@kernel.org>
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: Fri, 28 Jul 2023 15:42:39 +0800 [thread overview]
Message-ID: <7ae37f46-2a4a-afe8-846c-df95a0d12be8@huawei.com> (raw)
In-Reply-To: <20230727-curvature-register-6eb0a2c60a8b@spud>
On 2023/7/27 21:34, Conor Dooley wrote:
> 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?
Sure, you are right. Here we should directly return the ERRNO passed
from platform_get_irq(), since platform_get_irq() has performed all
error checking inside.
Thanks for reminding.
Jiahao
>
>>
>> ret = devm_request_irq(&pdev->dev, spi->irq, mchp_corespi_interrupt,
>> IRQF_SHARED, dev_name(&pdev->dev), master);
>> --
>> 2.34.1
>>
prev parent reply other threads:[~2023-07-28 7:42 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
2023-07-28 7:42 ` chenjiahao (C) [this message]
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=7ae37f46-2a4a-afe8-846c-df95a0d12be8@huawei.com \
--to=chenjiahao16@huawei.com \
--cc=broonie@kernel.org \
--cc=conor.dooley@microchip.com \
--cc=conor@kernel.org \
--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).