Skip to contentSkip to conversation

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

PATCH In review Aishwarya Ramakrishnan 2 participants 2 messages May 3, 2020 I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: img-scb: Use devm_platform_ioremap_resource and remove superfluous error message.

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.

---
 drivers/i2c/busses/i2c-img-scb.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-img-scb.c +2 -6
index 422097a31c95..98a89301ed2a 100644
@@ -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)) {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Aishwarya Ramakrishnan

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

Signature · 2 lines
With Best Regards,
Andy Shevchenko