Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Thierry Reding and committed by
Greg Kroah-Hartman
97f4be60 8cbce1e5

+11 -15
+4 -3
drivers/staging/iio/adc/mxs-lradc.c
··· 15 15 * GNU General Public License for more details. 16 16 */ 17 17 18 + #include <linux/err.h> 18 19 #include <linux/interrupt.h> 19 20 #include <linux/device.h> 20 21 #include <linux/kernel.h> ··· 488 487 /* Grab the memory area */ 489 488 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 490 489 lradc->dev = &pdev->dev; 491 - lradc->base = devm_request_and_ioremap(dev, iores); 492 - if (!lradc->base) { 493 - ret = -EADDRNOTAVAIL; 490 + lradc->base = devm_ioremap_resource(dev, iores); 491 + if (IS_ERR(lradc->base)) { 492 + ret = PTR_ERR(lradc->base); 494 493 goto err_addr; 495 494 } 496 495
+3 -5
drivers/staging/nvec/nvec.c
··· 759 759 return -ENODEV; 760 760 } 761 761 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); 767 765 768 766 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 769 767 if (!res) {
+4 -7
drivers/staging/omap-thermal/omap-bandgap.c
··· 820 820 res = platform_get_resource(pdev, IORESOURCE_MEM, i); 821 821 if (!res) 822 822 break; 823 - chunk = devm_request_and_ioremap(&pdev->dev, res); 823 + chunk = devm_ioremap_resource(&pdev->dev, res); 824 824 if (i == 0) 825 825 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 + 832 829 i++; 833 830 } while (res); 834 831