public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch v2] usb: phy: msm: change devm_ioremap() to devm_ioremap_resource()
@ 2014-05-14 13:54 Dan Carpenter
  2014-05-19  9:19 ` Ivan T. Ivanov
  2014-05-19  9:39 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-05-14 13:54 UTC (permalink / raw)
  To: kernel-janitors

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 <dan.carpenter@oracle.com>
---
v2: the first version just swapped the IS_ERR() check for a NULL check

Thanks everyone for the review.  In the end, it was still a one line fix
so I forgive you Ivan.

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index c522c4f..4f88174 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);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-19  9:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-14 13:54 [patch v2] usb: phy: msm: change devm_ioremap() to devm_ioremap_resource() Dan Carpenter
2014-05-19  9:19 ` Ivan T. Ivanov
2014-05-19  9:39 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox