From: Chen Jiahao <chenjiahao16@huawei.com>
To: <conor.dooley@microchip.com>, <daire.mcnamara@microchip.com>,
<andi.shyti@kernel.org>, <linux-riscv@lists.infradead.org>,
<linux-i2c@vger.kernel.org>
Cc: <chenjiahao16@huawei.com>
Subject: [PATCH -next] i2c: microchip-corei2c: clean up redundant dev_err_probe()
Date: Fri, 28 Jul 2023 16:31:37 +0800 [thread overview]
Message-ID: <20230728083137.3528303-1-chenjiahao16@huawei.com> (raw)
Referring to platform_get_irq()'s definition, the return value has
already been checked, error message also been printed via
dev_err_probe() if ret < 0. 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/i2c/busses/i2c-microchip-corei2c.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-microchip-corei2c.c b/drivers/i2c/busses/i2c-microchip-corei2c.c
index 7f58f7eaabb6..0b0a1c4d17ca 100644
--- a/drivers/i2c/busses/i2c-microchip-corei2c.c
+++ b/drivers/i2c/busses/i2c-microchip-corei2c.c
@@ -378,9 +378,8 @@ static int mchp_corei2c_probe(struct platform_device *pdev)
return PTR_ERR(idev->base);
irq = platform_get_irq(pdev, 0);
- if (irq <= 0)
- return dev_err_probe(&pdev->dev, -ENXIO,
- "invalid IRQ %d for I2C controller\n", irq);
+ if (irq < 0)
+ return irq;
idev->i2c_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(idev->i2c_clk))
--
2.34.1
next reply other threads:[~2023-07-28 8:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 8:31 Chen Jiahao [this message]
2023-07-28 8:44 ` [PATCH -next] i2c: microchip-corei2c: clean up redundant dev_err_probe() Conor Dooley
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=20230728083137.3528303-1-chenjiahao16@huawei.com \
--to=chenjiahao16@huawei.com \
--cc=andi.shyti@kernel.org \
--cc=conor.dooley@microchip.com \
--cc=daire.mcnamara@microchip.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-riscv@lists.infradead.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