Skip to content

Commit 97f4be6

Browse files
Thierry Redinggregkh
authored andcommitted
staging: Convert to devm_ioremap_resource()
Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling. devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8cbce1e commit 97f4be6

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

‎drivers/staging/iio/adc/mxs-lradc.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* GNU General Public License for more details.
1616
*/
1717

18+
#include <linux/err.h>
1819
#include <linux/interrupt.h>
1920
#include <linux/device.h>
2021
#include <linux/kernel.h>
@@ -487,9 +488,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
487488
/* Grab the memory area */
488489
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
489490
lradc->dev = &pdev->dev;
490-
lradc->base = devm_request_and_ioremap(dev, iores);
491-
if (!lradc->base) {
492-
ret = -EADDRNOTAVAIL;
491+
lradc->base = devm_ioremap_resource(dev, iores);
492+
if (IS_ERR(lradc->base)) {
493+
ret = PTR_ERR(lradc->base);
493494
goto err_addr;
494495
}
495496

‎drivers/staging/nvec/nvec.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -759,11 +759,9 @@ static int tegra_nvec_probe(struct platform_device *pdev)
759759
return -ENODEV;
760760
}
761761

762-
base = devm_request_and_ioremap(&pdev->dev, res);
763-
if (!base) {
764-
dev_err(&pdev->dev, "Can't ioremap I2C region\n");
765-
return -ENOMEM;
766-
}
762+
base = devm_ioremap_resource(&pdev->dev, res);
763+
if (IS_ERR(base))
764+
return PTR_ERR(base);
767765

768766
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
769767
if (!res) {

‎drivers/staging/omap-thermal/omap-bandgap.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -820,15 +820,12 @@ static struct omap_bandgap *omap_bandgap_build(struct platform_device *pdev)
820820
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
821821
if (!res)
822822
break;
823-
chunk = devm_request_and_ioremap(&pdev->dev, res);
823+
chunk = devm_ioremap_resource(&pdev->dev, res);
824824
if (i == 0)
825825
bg_ptr->base = chunk;
826-
if (!chunk) {
827-
dev_err(&pdev->dev,
828-
"failed to request the IO (%d:%pR).\n",
829-
i, res);
830-
return ERR_PTR(-EADDRNOTAVAIL);
831-
}
826+
if (IS_ERR(chunk))
827+
return ERR_CAST(chunk);
828+
832829
i++;
833830
} while (res);
834831

0 commit comments

Comments
 (0)