diff mbox series

[-next,v2] i2c: remove redundant dev_err_probe()

Message ID 20230801134814.247782-1-wangzhu9@huawei.com
State Superseded
Headers show
Series [-next,v2] i2c: remove redundant dev_err_probe() | expand

Commit Message

Zhu Wang Aug. 1, 2023, 1:48 p.m. UTC
When platform_get_irq() is called, the error message has been printed,
so it need not to call dev_err_probe() to print error.

As the comment of platform_get_irq() says, it returned non-zero value
when it succeeded, and it returned negative value when it failed.

Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

---
Changes in v2:
- Update the comment, explain the return value of platform_get_irq().
---
 drivers/i2c/busses/i2c-davinci.c           | 2 +-
 drivers/i2c/busses/i2c-microchip-corei2c.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

Comments

Andi Shyti Aug. 2, 2023, 8:10 p.m. UTC | #1
Hi

On Tue, 01 Aug 2023 21:48:14 +0800, Zhu Wang wrote:
> When platform_get_irq() is called, the error message has been printed,
> so it need not to call dev_err_probe() to print error.
> 
> As the comment of platform_get_irq() says, it returned non-zero value
> when it succeeded, and it returned negative value when it failed.
> 
> 
> [...]

Applied to i2c/andi-for-next on

https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

Please note that this patch may still undergo further evaluation
and the final decision will be made in collaboration with
Wolfram.

Thank you,
Andi

Patches applied
===============
[1/1] i2c: remove redundant dev_err_probe()
      commit: 6a07ab839a9c14df82ba2fe0b5dd4faa85a64d89
Wolfram Sang Aug. 14, 2023, 3:11 p.m. UTC | #2
On Wed, Aug 02, 2023 at 10:10:36PM +0200, Andi Shyti wrote:
> Hi
> 
> On Tue, 01 Aug 2023 21:48:14 +0800, Zhu Wang wrote:
> > When platform_get_irq() is called, the error message has been printed,
> > so it need not to call dev_err_probe() to print error.
> > 
> > As the comment of platform_get_irq() says, it returned non-zero value
> > when it succeeded, and it returned negative value when it failed.
> > 
> > 
> > [...]
> 
> Applied to i2c/andi-for-next on

Applied to for-next (via Andi's branch), thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 52527189a7bf..329c952d5062 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -765,7 +765,7 @@  static int davinci_i2c_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n");
+		return irq;
 
 	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
 	if (!dev)
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))