Skip to content

Commit 06303c2

Browse files
Thierry Redinggregkh
authored andcommitted
memory: 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 8d1cbc9 commit 06303c2

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎drivers/memory/emif.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* it under the terms of the GNU General Public License version 2 as
1111
* published by the Free Software Foundation.
1212
*/
13+
#include <linux/err.h>
1314
#include <linux/kernel.h>
1415
#include <linux/reboot.h>
1516
#include <linux/platform_data/emif_plat.h>
@@ -1468,12 +1469,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
14681469
goto error;
14691470
}
14701471

1471-
emif->base = devm_request_and_ioremap(emif->dev, res);
1472-
if (!emif->base) {
1473-
dev_err(emif->dev, "%s: devm_request_and_ioremap() failed\n",
1474-
__func__);
1472+
emif->base = devm_ioremap_resource(emif->dev, res);
1473+
if (IS_ERR(emif->base))
14751474
goto error;
1476-
}
14771475

14781476
irq = platform_get_irq(pdev, 0);
14791477
if (irq < 0) {

‎drivers/memory/tegra20-mc.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
1818
*/
1919

20+
#include <linux/err.h>
2021
#include <linux/kernel.h>
2122
#include <linux/module.h>
2223
#include <linux/ratelimit.h>
@@ -216,9 +217,9 @@ static int tegra20_mc_probe(struct platform_device *pdev)
216217
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
217218
if (!res)
218219
return -ENODEV;
219-
mc->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
220-
if (!mc->regs[i])
221-
return -EBUSY;
220+
mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
221+
if (IS_ERR(mc->regs[i]))
222+
return PTR_ERR(mc->regs[i]);
222223
}
223224

224225
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

‎drivers/memory/tegra30-mc.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
1818
*/
1919

20+
#include <linux/err.h>
2021
#include <linux/kernel.h>
2122
#include <linux/module.h>
2223
#include <linux/ratelimit.h>
@@ -336,9 +337,9 @@ static int tegra30_mc_probe(struct platform_device *pdev)
336337
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
337338
if (!res)
338339
return -ENODEV;
339-
mc->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
340-
if (!mc->regs[i])
341-
return -EBUSY;
340+
mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
341+
if (IS_ERR(mc->regs[i]))
342+
return PTR_ERR(mc->regs[i]);
342343
}
343344

344345
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

0 commit comments

Comments
 (0)