linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: img-scb: Use devm_platform_ioremap_resource and remove superfluous error message.
@ 2020-05-03 13:10 Aishwarya Ramakrishnan
  2020-05-03 16:28 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Aishwarya Ramakrishnan @ 2020-05-03 13:10 UTC (permalink / raw)
  To: Aishwarya Ramakrishnan, Brendan Higgins, Thor Thayer,
	Kate Stewart, Allison Randal, Andy Shevchenko, Thomas Gleixner,
	linux-i2c, linux-kernel

Use the helper function that wraps the calls to
platform_get_resource() and devm_ioremap_resource()
together.

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

Suggested by coccinelle.

Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
---
 drivers/i2c/busses/i2c-img-scb.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 422097a31c95..98a89301ed2a 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1330,7 +1330,6 @@ static int img_i2c_probe(struct platform_device *pdev)
 {
 	struct device_node *node = pdev->dev.of_node;
 	struct img_i2c *i2c;
-	struct resource *res;
 	int irq, ret;
 	u32 val;
 
@@ -1338,16 +1337,13 @@ static int img_i2c_probe(struct platform_device *pdev)
 	if (!i2c)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	i2c->base = devm_ioremap_resource(&pdev->dev, res);
+	i2c->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(i2c->base))
 		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)) {
-- 
2.17.1


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

* Re: [PATCH] i2c: img-scb: Use devm_platform_ioremap_resource and remove superfluous error message.
  2020-05-03 13:10 [PATCH] i2c: img-scb: Use devm_platform_ioremap_resource and remove superfluous error message Aishwarya Ramakrishnan
@ 2020-05-03 16:28 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2020-05-03 16:28 UTC (permalink / raw)
  To: Aishwarya Ramakrishnan
  Cc: Brendan Higgins, Thor Thayer, Kate Stewart, Allison Randal,
	Andy Shevchenko, Thomas Gleixner, linux-i2c,
	Linux Kernel Mailing List

On Sun, May 3, 2020 at 4:13 PM Aishwarya Ramakrishnan
<aishwaryarj100@gmail.com> wrote:
>
> Use the helper function that wraps the calls to
> platform_get_resource() and devm_ioremap_resource()
> together.
>
> The function platform_get_irq can log an error by itself.
> Omit a redundant message for exception handling in the
> calling function.
>
> Suggested by coccinelle.

Should be two patches, each of which with an explanation given. (And
of course you have to mention after cutter line '---' what kind of
tests you performed?)

-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2020-05-03 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-03 13:10 [PATCH] i2c: img-scb: Use devm_platform_ioremap_resource and remove superfluous error message Aishwarya Ramakrishnan
2020-05-03 16:28 ` Andy Shevchenko

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