Skip to content

Commit 57ae575

Browse files
Sachin KamatFelipe Balbi
authored andcommitted
usb: phy: omap-control-usb: Convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of devm_request_and_ioremap() 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. Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
1 parent 862421d commit 57ae575

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

‎drivers/usb/phy/omap-control-usb.c‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,32 +219,26 @@ static int omap_control_usb_probe(struct platform_device *pdev)
219219

220220
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
221221
"control_dev_conf");
222-
control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res);
223-
if (!control_usb->dev_conf) {
224-
dev_err(&pdev->dev, "Failed to obtain io memory\n");
225-
return -EADDRNOTAVAIL;
226-
}
222+
control_usb->dev_conf = devm_ioremap_resource(&pdev->dev, res);
223+
if (IS_ERR(control_usb->dev_conf))
224+
return PTR_ERR(control_usb->dev_conf);
227225

228226
if (control_usb->type == OMAP_CTRL_DEV_TYPE1) {
229227
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
230228
"otghs_control");
231-
control_usb->otghs_control = devm_request_and_ioremap(
229+
control_usb->otghs_control = devm_ioremap_resource(
232230
&pdev->dev, res);
233-
if (!control_usb->otghs_control) {
234-
dev_err(&pdev->dev, "Failed to obtain io memory\n");
235-
return -EADDRNOTAVAIL;
236-
}
231+
if (IS_ERR(control_usb->otghs_control))
232+
return PTR_ERR(control_usb->otghs_control);
237233
}
238234

239235
if (control_usb->type == OMAP_CTRL_DEV_TYPE2) {
240236
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
241237
"phy_power_usb");
242-
control_usb->phy_power = devm_request_and_ioremap(
238+
control_usb->phy_power = devm_ioremap_resource(
243239
&pdev->dev, res);
244-
if (!control_usb->phy_power) {
245-
dev_dbg(&pdev->dev, "Failed to obtain io memory\n");
246-
return -EADDRNOTAVAIL;
247-
}
240+
if (IS_ERR(control_usb->phy_power))
241+
return PTR_ERR(control_usb->phy_power);
248242

249243
control_usb->sys_clk = devm_clk_get(control_usb->dev,
250244
"sys_clkin");

0 commit comments

Comments
 (0)