From: Dan Carpenter Date: Wed, 14 May 2014 13:54:47 +0000 (+0300) Subject: usb: phy: msm: change devm_ioremap() to devm_ioremap_resource() X-Git-Tag: MMI-PSA29.97-13-9~11772^2~37^2~171^2~18 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=10f0577aa5cb;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git usb: phy: msm: change devm_ioremap() to devm_ioremap_resource() There are several issues here: 1) platform_get_resource() can return NULL and that wasn't handled. 2) We should request the memory before we remap it, and devm_ioremap_resource() does that. 3) devm_ioremap() returns a NULL but we were checking for IS_ERR(). Fixes: 6b99c68ec1f9 ('usb: phy: msm: Migrate to Managed Device Resource allocation') Signed-off-by: Dan Carpenter Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index c522c4ff8084..4f88174aede5 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -1586,7 +1586,7 @@ static int msm_otg_probe(struct platform_device *pdev) np ? "alt_core" : "usb_hs_core_clk"); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + motg->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(motg->regs)) return PTR_ERR(motg->regs);