[PATCH] i2c: img-scb: Use devm_platform_ioremap_resource and remove superfluous error message.

From: Aishwarya Ramakrishnan
Date: Sun May 03 2020 - 09:10:34 EST


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@xxxxxxxxx>
---
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