* [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq()
@ 2020-03-18 10:07 Tang Bin
2020-03-18 10:18 ` Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Tang Bin @ 2020-03-18 10:07 UTC (permalink / raw)
To: linux, s.hauer
Cc: shawnguo, linux-i2c, linux-arm-kernel, linux-kernel, Tang Bin
We don't need dev_err() message because when something goes wrong,
platform_get_irq() has print an error message itself, so we should
remove duplicate dev_err().
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
drivers/i2c/busses/i2c-imx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index a3b61336f..01fd46682 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1066,10 +1066,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "<%s>\n", __func__);
irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- dev_err(&pdev->dev, "can't get irq number\n");
+ if (irq < 0)
return irq;
- }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(&pdev->dev, res);
--
2.20.1.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq()
2020-03-18 10:07 [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq() Tang Bin
@ 2020-03-18 10:18 ` Uwe Kleine-König
2020-03-18 10:44 ` Wolfram Sang
2020-03-20 12:34 ` Oleksij Rempel
2020-03-21 18:56 ` Wolfram Sang
2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2020-03-18 10:18 UTC (permalink / raw)
To: Tang Bin
Cc: linux, s.hauer, shawnguo, linux-i2c, linux-arm-kernel, linux-kernel
On Wed, Mar 18, 2020 at 06:07:48PM +0800, Tang Bin wrote:
> We don't need dev_err() message because when something goes wrong,
> platform_get_irq() has print an error message itself, so we should
> remove duplicate dev_err().
>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
> drivers/i2c/busses/i2c-imx.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index a3b61336f..01fd46682 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1066,10 +1066,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
> dev_dbg(&pdev->dev, "<%s>\n", __func__);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(&pdev->dev, "can't get irq number\n");
> + if (irq < 0)
> return irq;
> - }
Maybe add a comment for the next person who wonders about an error path
without error message? Something like:
irq = platform_get_irq(pdev, 0);
if (irq < 0)
/*
* platform_get_irq() already issued an error message, so
* fail silently here.
*/
return irq;
And to get some extra kudos mention the commit that modified
platform_get_irq() to emit a message in the commit log.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq()
2020-03-18 10:18 ` Uwe Kleine-König
@ 2020-03-18 10:44 ` Wolfram Sang
0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2020-03-18 10:44 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Tang Bin, linux, s.hauer, shawnguo, linux-i2c, linux-arm-kernel,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 576 bytes --]
Hi Uwe,
> Maybe add a comment for the next person who wonders about an error path
> without error message? Something like:
>
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> /*
> * platform_get_irq() already issued an error message, so
> * fail silently here.
> */
> return irq;
Hmm, too much boilerplate for my taste. I'd rather assume it will be
printed during the call.
> And to get some extra kudos mention the commit that modified
> platform_get_irq() to emit a message in the commit log.
Yes.
Kind regards,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq()
2020-03-18 10:07 [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq() Tang Bin
2020-03-18 10:18 ` Uwe Kleine-König
@ 2020-03-20 12:34 ` Oleksij Rempel
2020-03-21 18:56 ` Wolfram Sang
2 siblings, 0 replies; 5+ messages in thread
From: Oleksij Rempel @ 2020-03-20 12:34 UTC (permalink / raw)
To: Tang Bin
Cc: linux, s.hauer, shawnguo, linux-i2c, linux-arm-kernel, linux-kernel
On Wed, Mar 18, 2020 at 06:07:48PM +0800, Tang Bin wrote:
> We don't need dev_err() message because when something goes wrong,
> platform_get_irq() has print an error message itself, so we should
> remove duplicate dev_err().
>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Thank you.
> ---
> drivers/i2c/busses/i2c-imx.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index a3b61336f..01fd46682 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1066,10 +1066,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
> dev_dbg(&pdev->dev, "<%s>\n", __func__);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - dev_err(&pdev->dev, "can't get irq number\n");
> + if (irq < 0)
> return irq;
> - }
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> base = devm_ioremap_resource(&pdev->dev, res);
> --
> 2.20.1.windows.1
>
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq()
2020-03-18 10:07 [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq() Tang Bin
2020-03-18 10:18 ` Uwe Kleine-König
2020-03-20 12:34 ` Oleksij Rempel
@ 2020-03-21 18:56 ` Wolfram Sang
2 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2020-03-21 18:56 UTC (permalink / raw)
To: Tang Bin
Cc: linux, s.hauer, shawnguo, linux-i2c, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 401 bytes --]
On Wed, Mar 18, 2020 at 06:07:48PM +0800, Tang Bin wrote:
> We don't need dev_err() message because when something goes wrong,
> platform_get_irq() has print an error message itself, so we should
> remove duplicate dev_err().
>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Applied to for-next, thanks! But please use a proper prefix in the
subject next time ("i2c: imx: ...")
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-21 18:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 10:07 [PATCH] drivers/i2c/busses/i2c-imx.c:remove duplicate print after platform_get_irq() Tang Bin
2020-03-18 10:18 ` Uwe Kleine-König
2020-03-18 10:44 ` Wolfram Sang
2020-03-20 12:34 ` Oleksij Rempel
2020-03-21 18:56 ` Wolfram Sang
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).