Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57ae575b authored by Sachin Kamat's avatar Sachin Kamat Committed by Felipe Balbi
Browse files

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: default avatarThierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 862421da
Loading
Loading
Loading
Loading
+9 −15
Original line number Diff line number Diff line
@@ -219,32 +219,26 @@ static int omap_control_usb_probe(struct platform_device *pdev)

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
		"control_dev_conf");
	control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res);
	if (!control_usb->dev_conf) {
		dev_err(&pdev->dev, "Failed to obtain io memory\n");
		return -EADDRNOTAVAIL;
	}
	control_usb->dev_conf = devm_ioremap_resource(&pdev->dev, res);
	if (IS_ERR(control_usb->dev_conf))
		return PTR_ERR(control_usb->dev_conf);

	if (control_usb->type == OMAP_CTRL_DEV_TYPE1) {
		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
			"otghs_control");
		control_usb->otghs_control = devm_request_and_ioremap(
		control_usb->otghs_control = devm_ioremap_resource(
			&pdev->dev, res);
		if (!control_usb->otghs_control) {
			dev_err(&pdev->dev, "Failed to obtain io memory\n");
			return -EADDRNOTAVAIL;
		}
		if (IS_ERR(control_usb->otghs_control))
			return PTR_ERR(control_usb->otghs_control);
	}

	if (control_usb->type == OMAP_CTRL_DEV_TYPE2) {
		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
			"phy_power_usb");
		control_usb->phy_power = devm_request_and_ioremap(
		control_usb->phy_power = devm_ioremap_resource(
			&pdev->dev, res);
		if (!control_usb->phy_power) {
			dev_dbg(&pdev->dev, "Failed to obtain io memory\n");
			return -EADDRNOTAVAIL;
		}
		if (IS_ERR(control_usb->phy_power))
			return PTR_ERR(control_usb->phy_power);

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