Patchwork i2c-designware-platform: don't check resource with devm_ioremap_resource

login
register
mail settings
Submitter Andy Shevchenko
Date June 7, 2013, 1:57 p.m.
Message ID <1370613449-29719-1-git-send-email-andriy.shevchenko@linux.intel.com>
Download mbox | patch
Permalink /patch/249730/
State Superseded
Headers show

Comments

Andy Shevchenko - June 7, 2013, 1:57 p.m.
devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
Wolfram Sang - June 11, 2013, 6:58 p.m.
On Fri, Jun 07, 2013 at 04:57:29PM +0300, Andy Shevchenko wrote:
> devm_ioremap_resource does sanity checks on the given resource. No need to
> duplicate this in the driver.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, yet I applied my original patch which removes this pattern from
the whole subsystem.

Patch

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 35b70a1..ee46c92 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -87,13 +87,6 @@  static int dw_i2c_probe(struct platform_device *pdev)
 	struct resource *mem;
 	int irq, r;
 
-	/* NOTE: driver uses the static register mapping */
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!mem) {
-		dev_err(&pdev->dev, "no mem resource?\n");
-		return -EINVAL;
-	}
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "no irq resource?\n");
@@ -104,6 +97,7 @@  static int dw_i2c_probe(struct platform_device *pdev)
 	if (!dev)
 		return -ENOMEM;
 
+	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	dev->base = devm_ioremap_resource(&pdev->dev, mem);
 	if (IS_ERR(dev->base))
 		return PTR_ERR(dev->base);