2020-05-03 12:10:46

by Aishwarya Ramakrishnan

[permalink] [raw]
Subject: [PATCH] i2c: uniphier: Remove superfluous error message in uniphier_i2c_probe()

The function platform_get_irq can log an error by itself.
This omit a redundant message for exception handling in the
calling function.

Suggested by Coccinelle.

Signed-off-by: Aishwarya Ramakrishnan <[email protected]>
---
drivers/i2c/busses/i2c-uniphier.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
index 668b1fa2b0ef..ee00a44bf4c7 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -324,10 +324,8 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
return PTR_ERR(priv->membase);

irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- dev_err(dev, "failed to get IRQ number\n");
+ if (irq < 0)
return irq;
- }

if (of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed))
bus_speed = I2C_MAX_STANDARD_MODE_FREQ;
--
2.17.1


2020-05-03 13:31:00

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c: uniphier: Remove superfluous error message in uniphier_i2c_probe()

On Sun, May 03, 2020 at 05:38:47PM +0530, Aishwarya Ramakrishnan wrote:
> The function platform_get_irq can log an error by itself.
> This omit a redundant message for exception handling in the
> calling function.
>
> Suggested by Coccinelle.
>
> Signed-off-by: Aishwarya Ramakrishnan <[email protected]>

Please send only one patch for the whole I2C subsystem.


Attachments:
(No filename) (383.00 B)
signature.asc (849.00 B)
Download all attachments

2020-05-04 01:17:27

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] i2c: uniphier: Remove superfluous error message in uniphier_i2c_probe()

On Sun, May 3, 2020 at 10:29 PM Wolfram Sang <[email protected]> wrote:
>
> On Sun, May 03, 2020 at 05:38:47PM +0530, Aishwarya Ramakrishnan wrote:
> > The function platform_get_irq can log an error by itself.
> > This omit a redundant message for exception handling in the
> > calling function.
> >
> > Suggested by Coccinelle.
> >
> > Signed-off-by: Aishwarya Ramakrishnan <[email protected]>
>
> Please send only one patch for the whole I2C subsystem.
>

Yeah, and then please add my ack to v2.

Acked-by: Masahiro Yamada <[email protected]>


--
Best Regards
Masahiro Yamada

2020-05-04 11:47:23

by Aishwarya Ramakrishnan

[permalink] [raw]
Subject: [PATCH] i2c: drivers: Remove superfluous error message

The function platform_get_irq can log an error by itself.
This omit a redundant message for exception handling in the
calling function.

Suggested by Coccinelle.

Signed-off-by: Aishwarya Ramakrishnan <[email protected]>
---
drivers/i2c/busses/i2c-altera.c | 4 +---
drivers/i2c/busses/i2c-cht-wc.c | 4 +---
drivers/i2c/busses/i2c-img-scb.c | 4 +---
drivers/i2c/busses/i2c-lpc2k.c | 4 +---
drivers/i2c/busses/i2c-uniphier.c | 4 +---
5 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
index f5c00f903df3..af6985f0ae63 100644
--- a/drivers/i2c/busses/i2c-altera.c
+++ b/drivers/i2c/busses/i2c-altera.c
@@ -395,10 +395,8 @@ static int altr_i2c_probe(struct platform_device *pdev)
return PTR_ERR(idev->base);

irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- dev_err(&pdev->dev, "missing interrupt resource\n");
+ if (irq < 0)
return irq;
- }

idev->i2c_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(idev->i2c_clk)) {
diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
index 35e55feda763..343ae5754e6e 100644
--- a/drivers/i2c/busses/i2c-cht-wc.c
+++ b/drivers/i2c/busses/i2c-cht-wc.c
@@ -314,10 +314,8 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
int ret, reg, irq;

irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- dev_err(&pdev->dev, "Error missing irq resource\n");
+ if (irq < 0)
return -EINVAL;
- }

adap = devm_kzalloc(&pdev->dev, sizeof(*adap), GFP_KERNEL);
if (!adap)
diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 422097a31c95..2f6de763816a 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1344,10 +1344,8 @@ static int img_i2c_probe(struct platform_device *pdev)
return PTR_ERR(i2c->base);

irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- dev_err(&pdev->dev, "can't get irq number\n");
+ if (irq < 0)
return irq;
- }

i2c->sys_clk = devm_clk_get(&pdev->dev, "sys");
if (IS_ERR(i2c->sys_clk)) {
diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
index 13b0c12e2dba..43dc9b7043e4 100644
--- a/drivers/i2c/busses/i2c-lpc2k.c
+++ b/drivers/i2c/busses/i2c-lpc2k.c
@@ -362,10 +362,8 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
return PTR_ERR(i2c->base);

i2c->irq = platform_get_irq(pdev, 0);
- if (i2c->irq < 0) {
- dev_err(&pdev->dev, "can't get interrupt resource\n");
+ if (i2c->irq < 0)
return i2c->irq;
- }

init_waitqueue_head(&i2c->wait);

diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
index 668b1fa2b0ef..ee00a44bf4c7 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -324,10 +324,8 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
return PTR_ERR(priv->membase);

irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- dev_err(dev, "failed to get IRQ number\n");
+ if (irq < 0)
return irq;
- }

if (of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed))
bus_speed = I2C_MAX_STANDARD_MODE_FREQ;
--
2.17.1

2020-05-04 14:33:26

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] i2c: drivers: Remove superfluous error message

On Mon, May 4, 2020 at 8:44 PM Aishwarya Ramakrishnan
<[email protected]> wrote:
>
> The function platform_get_irq can log an error by itself.
> This omit a redundant message for exception handling in the
> calling function.
>
> Suggested by Coccinelle.
>
> Signed-off-by: Aishwarya Ramakrishnan <[email protected]>
> ---
> drivers/i2c/busses/i2c-altera.c | 4 +---
> drivers/i2c/busses/i2c-cht-wc.c | 4 +---
> drivers/i2c/busses/i2c-img-scb.c | 4 +---
> drivers/i2c/busses/i2c-lpc2k.c | 4 +---
> drivers/i2c/busses/i2c-uniphier.c | 4 +---


Acked-by: Masahiro Yamada <[email protected]>


I see more drivers with the similar pattern, though.






> 5 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
> index f5c00f903df3..af6985f0ae63 100644
> --- a/drivers/i2c/busses/i2c-altera.c
> +++ b/drivers/i2c/busses/i2c-altera.c
> @@ -395,10 +395,8 @@ static int altr_i2c_probe(struct platform_device *pdev)
> return PTR_ERR(idev->base);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(&pdev->dev, "missing interrupt resource\n");
> + if (irq < 0)
> return irq;
> - }
>
> idev->i2c_clk = devm_clk_get(&pdev->dev, NULL);
> if (IS_ERR(idev->i2c_clk)) {
> diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
> index 35e55feda763..343ae5754e6e 100644
> --- a/drivers/i2c/busses/i2c-cht-wc.c
> +++ b/drivers/i2c/busses/i2c-cht-wc.c
> @@ -314,10 +314,8 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
> int ret, reg, irq;
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(&pdev->dev, "Error missing irq resource\n");
> + if (irq < 0)
> return -EINVAL;
> - }
>
> adap = devm_kzalloc(&pdev->dev, sizeof(*adap), GFP_KERNEL);
> if (!adap)
> diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
> index 422097a31c95..2f6de763816a 100644
> --- a/drivers/i2c/busses/i2c-img-scb.c
> +++ b/drivers/i2c/busses/i2c-img-scb.c
> @@ -1344,10 +1344,8 @@ static int img_i2c_probe(struct platform_device *pdev)
> return PTR_ERR(i2c->base);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(&pdev->dev, "can't get irq number\n");
> + if (irq < 0)
> return irq;
> - }
>
> i2c->sys_clk = devm_clk_get(&pdev->dev, "sys");
> if (IS_ERR(i2c->sys_clk)) {
> diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
> index 13b0c12e2dba..43dc9b7043e4 100644
> --- a/drivers/i2c/busses/i2c-lpc2k.c
> +++ b/drivers/i2c/busses/i2c-lpc2k.c
> @@ -362,10 +362,8 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
> return PTR_ERR(i2c->base);
>
> i2c->irq = platform_get_irq(pdev, 0);
> - if (i2c->irq < 0) {
> - dev_err(&pdev->dev, "can't get interrupt resource\n");
> + if (i2c->irq < 0)
> return i2c->irq;
> - }
>
> init_waitqueue_head(&i2c->wait);
>
> diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
> index 668b1fa2b0ef..ee00a44bf4c7 100644
> --- a/drivers/i2c/busses/i2c-uniphier.c
> +++ b/drivers/i2c/busses/i2c-uniphier.c
> @@ -324,10 +324,8 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
> return PTR_ERR(priv->membase);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(dev, "failed to get IRQ number\n");
> + if (irq < 0)
> return irq;
> - }
>
> if (of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed))
> bus_speed = I2C_MAX_STANDARD_MODE_FREQ;
> --
> 2.17.1
>


--
Best Regards
Masahiro Yamada

2020-05-04 14:53:07

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] i2c: drivers: Remove superfluous error message

On Mon, May 04, 2020 at 05:14:06PM +0530, Aishwarya Ramakrishnan wrote:
> The function platform_get_irq can log an error by itself.
> This omit a redundant message for exception handling in the
> calling function.

FWIW,
Reviewed-by: Andy Shevchenko <[email protected]>


> Suggested by Coccinelle.

Compile tested only, right?

>
> Signed-off-by: Aishwarya Ramakrishnan <[email protected]>
> ---
> drivers/i2c/busses/i2c-altera.c | 4 +---
> drivers/i2c/busses/i2c-cht-wc.c | 4 +---
> drivers/i2c/busses/i2c-img-scb.c | 4 +---
> drivers/i2c/busses/i2c-lpc2k.c | 4 +---
> drivers/i2c/busses/i2c-uniphier.c | 4 +---
> 5 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
> index f5c00f903df3..af6985f0ae63 100644
> --- a/drivers/i2c/busses/i2c-altera.c
> +++ b/drivers/i2c/busses/i2c-altera.c
> @@ -395,10 +395,8 @@ static int altr_i2c_probe(struct platform_device *pdev)
> return PTR_ERR(idev->base);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(&pdev->dev, "missing interrupt resource\n");
> + if (irq < 0)
> return irq;
> - }
>
> idev->i2c_clk = devm_clk_get(&pdev->dev, NULL);
> if (IS_ERR(idev->i2c_clk)) {
> diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
> index 35e55feda763..343ae5754e6e 100644
> --- a/drivers/i2c/busses/i2c-cht-wc.c
> +++ b/drivers/i2c/busses/i2c-cht-wc.c
> @@ -314,10 +314,8 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
> int ret, reg, irq;
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(&pdev->dev, "Error missing irq resource\n");
> + if (irq < 0)
> return -EINVAL;
> - }
>
> adap = devm_kzalloc(&pdev->dev, sizeof(*adap), GFP_KERNEL);
> if (!adap)
> diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
> index 422097a31c95..2f6de763816a 100644
> --- a/drivers/i2c/busses/i2c-img-scb.c
> +++ b/drivers/i2c/busses/i2c-img-scb.c
> @@ -1344,10 +1344,8 @@ static int img_i2c_probe(struct platform_device *pdev)
> return PTR_ERR(i2c->base);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(&pdev->dev, "can't get irq number\n");
> + if (irq < 0)
> return irq;
> - }
>
> i2c->sys_clk = devm_clk_get(&pdev->dev, "sys");
> if (IS_ERR(i2c->sys_clk)) {
> diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
> index 13b0c12e2dba..43dc9b7043e4 100644
> --- a/drivers/i2c/busses/i2c-lpc2k.c
> +++ b/drivers/i2c/busses/i2c-lpc2k.c
> @@ -362,10 +362,8 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
> return PTR_ERR(i2c->base);
>
> i2c->irq = platform_get_irq(pdev, 0);
> - if (i2c->irq < 0) {
> - dev_err(&pdev->dev, "can't get interrupt resource\n");
> + if (i2c->irq < 0)
> return i2c->irq;
> - }
>
> init_waitqueue_head(&i2c->wait);
>
> diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
> index 668b1fa2b0ef..ee00a44bf4c7 100644
> --- a/drivers/i2c/busses/i2c-uniphier.c
> +++ b/drivers/i2c/busses/i2c-uniphier.c
> @@ -324,10 +324,8 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
> return PTR_ERR(priv->membase);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(dev, "failed to get IRQ number\n");
> + if (irq < 0)
> return irq;
> - }
>
> if (of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed))
> bus_speed = I2C_MAX_STANDARD_MODE_FREQ;
> --
> 2.17.1
>

--
With Best Regards,
Andy Shevchenko


2020-05-04 14:53:19

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] i2c: drivers: Remove superfluous error message

On Mon, May 04, 2020 at 03:42:56PM +0300, Andy Shevchenko wrote:
> On Mon, May 04, 2020 at 05:14:06PM +0530, Aishwarya Ramakrishnan wrote:
> > The function platform_get_irq can log an error by itself.
> > This omit a redundant message for exception handling in the
> > calling function.
>
> FWIW,
> Reviewed-by: Andy Shevchenko <[email protected]>

Wolfram, I didn't notice any updates in your public tree. Do you have plans to
push them this week?

--
With Best Regards,
Andy Shevchenko


2020-05-05 14:16:03

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c: drivers: Remove superfluous error message

On Mon, May 04, 2020 at 05:14:06PM +0530, Aishwarya Ramakrishnan wrote:
> The function platform_get_irq can log an error by itself.
> This omit a redundant message for exception handling in the
> calling function.
>
> Suggested by Coccinelle.
>
> Signed-off-by: Aishwarya Ramakrishnan <[email protected]>

Sorry, I forgot that these are already fixed with
e42688ed5cf5936fb55c78cc365dbe0944af7c63 in i2c/for-next.


Attachments:
(No filename) (436.00 B)
signature.asc (849.00 B)
Download all attachments