Skip to contentSkip to conversation

usb: phy: msm: fix bug in probe()

PATCH In review Dan Carpenter 2 participants 3 messages May 19, 2014 – May 20, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: phy: msm: fix bug in probe()

My previous patch introduced a bug which prevented this driver from loading. devm_ioremap_resource() has a call to devm_request_mem_region() which will fail because the address space is shared between this PHY driver and CI device controller driver.

Fixes 10f0577aa5cb ('usb: phy: msm: change devm_ioremap() to devm_ioremap_resource()')
drivers/usb/phy/phy-msm-usb.c +5 -3
index 4f88174..ced34f3 100644
@@ -1586,9 +1586,11 @@ 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_resource(&pdev->dev, res);
-	if (IS_ERR(motg->regs))
-		return PTR_ERR(motg->regs);
+	if (!res)
+		return -EINVAL;
+	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+	if (!motg->regs)
+		return -ENOMEM;
 
 	/*
 	 * NOTE: The PHYs can be multiplexed between the chipidea controller
#1 lore raw
Quoted 15 lines · Dan Carpenter

My previous patch introduced a bug which prevented this driver from loading. devm_ioremap_resource() has a call to devm_request_mem_region() which will fail because the address space is shared between this PHY driver and CI device controller driver.

Fixes 10f0577aa5cb ('usb: phy: msm: change devm_ioremap() to devm_ioremap_resource()')
drivers/usb/phy/phy-msm-usb.c +0 -0
index 4f88174..ced34f3 100644
@@ -1586,9 +1586,11 @@ static int msm_otg_probe(struct platform_device *pdev)
 				      np ? "alt_core" : "usb_hs_core_clk");

drivers/usb/phy/phy-msm-usb.c static int msm_otg_probe(struct platform_device *pdev) · line 1593

Quoted 10 lines
drivers/usb/phy/phy-msm-usb.c +5 -3
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	motg->regs = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(motg->regs))
-		return PTR_ERR(motg->regs);
+	if (!res)
+		return -EINVAL;
+	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+	if (!motg->regs)
+		return -ENOMEM;

Well, I don't think that your previous patch was merged anywhere. Or I am missing something? So you have to just made v3 of your original patch.

Regards,
Ivan

#2 lore raw
In reply to Dan Carpenter
Quoted 17 lines · Ivan T. Ivanov
Quoted 16 lines · Dan Carpenter

My previous patch introduced a bug which prevented this driver from loading. devm_ioremap_resource() has a call to devm_request_mem_region() which will fail because the address space is shared between this PHY driver and CI device controller driver.

Fixes 10f0577aa5cb ('usb: phy: msm: change devm_ioremap() to devm_ioremap_resource()')
drivers/usb/phy/phy-msm-usb.c +0 -0
index 4f88174..ced34f3 100644
@@ -1586,9 +1586,11 @@ static int msm_otg_probe(struct platform_device *pdev)
 				      np ? "alt_core" : "usb_hs_core_clk");
 
Quoted 12 lines

drivers/usb/phy/phy-msm-usb.c static int msm_otg_probe(struct platform_device *pdev) · line 1593

Quoted 9 lines
drivers/usb/phy/phy-msm-usb.c +5 -3
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	motg->regs = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(motg->regs))
-		return PTR_ERR(motg->regs);
+	if (!res)
+		return -EINVAL;
+	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+	if (!motg->regs)
+		return -ENOMEM;

Well, I don't think that your previous patch was merged anywhere. Or I am missing something?

Yeah. It was merged.

regards,
dan carpenter