On Tue, May 13, 2014 at 03:21:42AM +0200, abdoulaye berthe wrote: [...] > diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c [...] > iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (!iomem) { > - err = -EINVAL; > - goto err_mem; > + dev_err(dev, "Unable to get resource\n"); > + return -EINVAL; > } [...] > - if (!request_mem_region(iomem->start, resource_size(iomem), > - DRIVER_NAME)) { > - err = -EBUSY; > - goto err_request; > + if (!devm_request_mem_region(dev, iomem->start, resource_size(iomem), > + DRIVER_NAME)) { > + dev_err(dev, "Region already claimed\n"); > + return -EBUSY; > } > > - tgpio->membase = ioremap(iomem->start, resource_size(iomem)); > + tgpio->membase = devm_ioremap(dev, iomem->start, resource_size(iomem)); > if (!tgpio->membase) { > - err = -ENOMEM; > - goto err_ioremap; > + dev_err(dev, "Cannot ioremap\n"); > + return -ENOMEM; > } The above could be further simplified to: iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); tgpio->membase = devm_ioremap_resource(&pdev->dev, iomem); if (IS_ERR(tgpio->membase)) return PTR_ERR(tgpio->membase); Where devm_ioremap_resource() already provides error messages as appropriate. Thierry
Attachment:
pgpZqMJZLVtR2.pgp
Description: PGP signature