linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: exynos5: fix platform_get_irq error handling
@ 2020-10-27 21:42 Martin Kaiser
  2020-10-28  7:21 ` Krzysztof Kozlowski
  2020-11-01 17:18 ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Martin Kaiser
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Kaiser @ 2020-10-27 21:42 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wolfram Sang, Andrzej Hajda
  Cc: linux-i2c, linux-samsung-soc, linux-kernel, Martin Kaiser

platform_get_irq already prints an error message if the requested irq
was not found. Don't print another message in the driver.

If platform_get_irq returns an error, relay this error to the caller of the
probe function. Don't change all errors to -EINVAL. This breaks the case
where platform_get_irq returns -EPROBE_DEFER.

platform_get_irq never returns 0. Don't check for this. Make it clear that
the error path always returns a negative error code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/i2c/busses/i2c-exynos5.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index 6ce3ec03b595..20a9881a0d6c 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -778,11 +778,8 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
 	init_completion(&i2c->msg_complete);
 
 	i2c->irq = ret = platform_get_irq(pdev, 0);
-	if (ret <= 0) {
-		dev_err(&pdev->dev, "cannot find HS-I2C IRQ\n");
-		ret = -EINVAL;
+	if (ret < 0)
 		goto err_clk;
-	}
 
 	ret = devm_request_irq(&pdev->dev, i2c->irq, exynos5_i2c_irq,
 			       IRQF_NO_SUSPEND, dev_name(&pdev->dev), i2c);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] i2c: exynos5: fix platform_get_irq error handling
  2020-10-27 21:42 [PATCH] i2c: exynos5: fix platform_get_irq error handling Martin Kaiser
@ 2020-10-28  7:21 ` Krzysztof Kozlowski
  2020-11-01 17:18 ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Martin Kaiser
  1 sibling, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2020-10-28  7:21 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Wolfram Sang, Andrzej Hajda, linux-i2c, linux-samsung-soc, linux-kernel

On Tue, Oct 27, 2020 at 10:42:57PM +0100, Martin Kaiser wrote:
> platform_get_irq already prints an error message if the requested irq
> was not found. Don't print another message in the driver.
> 
> If platform_get_irq returns an error, relay this error to the caller of the
> probe function. Don't change all errors to -EINVAL. This breaks the case
> where platform_get_irq returns -EPROBE_DEFER.
> 
> platform_get_irq never returns 0. Don't check for this. Make it clear that
> the error path always returns a negative error code.

These should be three separate commits.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] i2c: exynos5: remove duplicate error message
  2020-10-27 21:42 [PATCH] i2c: exynos5: fix platform_get_irq error handling Martin Kaiser
  2020-10-28  7:21 ` Krzysztof Kozlowski
@ 2020-11-01 17:18 ` Martin Kaiser
  2020-11-01 17:18   ` [PATCH v2 2/3] i2c: exynos5: fix platform_get_irq error handling Martin Kaiser
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Martin Kaiser @ 2020-11-01 17:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wolfram Sang, Andrzej Hajda
  Cc: linux-i2c, linux-samsung-soc, linux-kernel, Martin Kaiser

platform_get_irq already prints an error message if the requested irq
was not found. Don't print another message in the driver.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
changes in v2
- split the patch in three parts

 drivers/i2c/busses/i2c-exynos5.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index 6ce3ec03b595..c5f5fb28762d 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -779,7 +779,6 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
 
 	i2c->irq = ret = platform_get_irq(pdev, 0);
 	if (ret <= 0) {
-		dev_err(&pdev->dev, "cannot find HS-I2C IRQ\n");
 		ret = -EINVAL;
 		goto err_clk;
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] i2c: exynos5: fix platform_get_irq error handling
  2020-11-01 17:18 ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Martin Kaiser
@ 2020-11-01 17:18   ` Martin Kaiser
  2020-11-02  8:39     ` Krzysztof Kozlowski
  2020-11-01 17:18   ` [PATCH v2 3/3] i2c: exynos5: don't check for irq 0 Martin Kaiser
  2020-11-02  8:37   ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Krzysztof Kozlowski
  2 siblings, 1 reply; 8+ messages in thread
From: Martin Kaiser @ 2020-11-01 17:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wolfram Sang, Andrzej Hajda
  Cc: linux-i2c, linux-samsung-soc, linux-kernel, Martin Kaiser

If platform_get_irq returns an error, relay this error to the caller of
the probe function. Don't change all errors to -EINVAL. This breaks the
case where platform_get_irq returns -EPROBE_DEFER.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
changes in v2
- split the patch in three parts

 drivers/i2c/busses/i2c-exynos5.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index c5f5fb28762d..fad1c52857aa 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -778,10 +778,8 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
 	init_completion(&i2c->msg_complete);
 
 	i2c->irq = ret = platform_get_irq(pdev, 0);
-	if (ret <= 0) {
-		ret = -EINVAL;
+	if (ret <= 0)
 		goto err_clk;
-	}
 
 	ret = devm_request_irq(&pdev->dev, i2c->irq, exynos5_i2c_irq,
 			       IRQF_NO_SUSPEND, dev_name(&pdev->dev), i2c);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] i2c: exynos5: don't check for irq 0
  2020-11-01 17:18 ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Martin Kaiser
  2020-11-01 17:18   ` [PATCH v2 2/3] i2c: exynos5: fix platform_get_irq error handling Martin Kaiser
@ 2020-11-01 17:18   ` Martin Kaiser
  2020-11-02  8:37     ` Krzysztof Kozlowski
  2020-11-02  8:37   ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Krzysztof Kozlowski
  2 siblings, 1 reply; 8+ messages in thread
From: Martin Kaiser @ 2020-11-01 17:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wolfram Sang, Andrzej Hajda
  Cc: linux-i2c, linux-samsung-soc, linux-kernel, Martin Kaiser

platform_get_irq never returns 0. Don't check for this. Make it clear that
the error path always returns a negative error code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
changes in v2
- split the patch in three parts

 drivers/i2c/busses/i2c-exynos5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index fad1c52857aa..20a9881a0d6c 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -778,7 +778,7 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
 	init_completion(&i2c->msg_complete);
 
 	i2c->irq = ret = platform_get_irq(pdev, 0);
-	if (ret <= 0)
+	if (ret < 0)
 		goto err_clk;
 
 	ret = devm_request_irq(&pdev->dev, i2c->irq, exynos5_i2c_irq,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] i2c: exynos5: don't check for irq 0
  2020-11-01 17:18   ` [PATCH v2 3/3] i2c: exynos5: don't check for irq 0 Martin Kaiser
@ 2020-11-02  8:37     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2020-11-02  8:37 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Wolfram Sang, Andrzej Hajda, linux-i2c, linux-samsung-soc, linux-kernel

On Sun, Nov 01, 2020 at 06:18:07PM +0100, Martin Kaiser wrote:
> platform_get_irq never returns 0. Don't check for this. Make it clear that
> the error path always returns a negative error code.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
> changes in v2
> - split the patch in three parts
> 
>  drivers/i2c/busses/i2c-exynos5.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/3] i2c: exynos5: remove duplicate error message
  2020-11-01 17:18 ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Martin Kaiser
  2020-11-01 17:18   ` [PATCH v2 2/3] i2c: exynos5: fix platform_get_irq error handling Martin Kaiser
  2020-11-01 17:18   ` [PATCH v2 3/3] i2c: exynos5: don't check for irq 0 Martin Kaiser
@ 2020-11-02  8:37   ` Krzysztof Kozlowski
  2 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2020-11-02  8:37 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Wolfram Sang, Andrzej Hajda, linux-i2c, linux-samsung-soc, linux-kernel

On Sun, Nov 01, 2020 at 06:18:05PM +0100, Martin Kaiser wrote:
> platform_get_irq already prints an error message if the requested irq
> was not found. Don't print another message in the driver.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
> changes in v2
> - split the patch in three parts
> 
>  drivers/i2c/busses/i2c-exynos5.c | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/3] i2c: exynos5: fix platform_get_irq error handling
  2020-11-01 17:18   ` [PATCH v2 2/3] i2c: exynos5: fix platform_get_irq error handling Martin Kaiser
@ 2020-11-02  8:39     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2020-11-02  8:39 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Wolfram Sang, Andrzej Hajda, linux-i2c, linux-samsung-soc, linux-kernel

On Sun, Nov 01, 2020 at 06:18:06PM +0100, Martin Kaiser wrote:
> If platform_get_irq returns an error, relay this error to the caller of
> the probe function. Don't change all errors to -EINVAL. This breaks the
> case where platform_get_irq returns -EPROBE_DEFER.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
> changes in v2
> - split the patch in three parts
> 
>  drivers/i2c/busses/i2c-exynos5.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-11-02  8:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27 21:42 [PATCH] i2c: exynos5: fix platform_get_irq error handling Martin Kaiser
2020-10-28  7:21 ` Krzysztof Kozlowski
2020-11-01 17:18 ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Martin Kaiser
2020-11-01 17:18   ` [PATCH v2 2/3] i2c: exynos5: fix platform_get_irq error handling Martin Kaiser
2020-11-02  8:39     ` Krzysztof Kozlowski
2020-11-01 17:18   ` [PATCH v2 3/3] i2c: exynos5: don't check for irq 0 Martin Kaiser
2020-11-02  8:37     ` Krzysztof Kozlowski
2020-11-02  8:37   ` [PATCH v2 1/3] i2c: exynos5: remove duplicate error message Krzysztof Kozlowski

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).