From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx> Commit e9f2cefb0cdc2ae ("usb: phy: generic: migrate to gpio_desc") broke USB on imx53-qsb board: [ 0.115456] usb_phy_generic 50000000.aips:usbphy@0: Error requesting RESET GPIO [ 0.115554] usb_phy_generic: probe of 50000000.aips:usbphy@0 failed with error -2 [ 0.115701] usb_phy_generic 50000000.aips:usbphy@1: Error requesting RESET GPIO [ 0.115761] usb_phy_generic: probe of 50000000.aips:usbphy@1 failed with error -2 Driver should still probe even when 'reset-gpios' property is not passed. Fix the error handling for devm_gpiod_get() and move the "Error requesting RESET GPIO" message right after devm_gpio_request_one(). Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx> --- I haven't tested the case when 'reset-gpios' is present yet. Changes since v1: - return the error in case of devm_gpio_request_one() failure drivers/usb/phy/phy-generic.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index dd05254..d28ae96 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -219,12 +219,13 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, needs_vcc = of_property_read_bool(node, "vcc-supply"); nop->gpiod_reset = devm_gpiod_get(dev, "reset-gpios"); - err = PTR_ERR(nop->gpiod_reset); - if (!err) { - nop->gpiod_vbus = devm_gpiod_get(dev, - "vbus-detect-gpio"); - err = PTR_ERR(nop->gpiod_vbus); - } + if (IS_ERR(nop->gpiod_reset)) + nop->gpiod_reset = NULL; + + nop->gpiod_vbus = devm_gpiod_get(dev, "vbus-detect-gpio"); + if (IS_ERR(nop->gpiod_vbus)) + nop->gpiod_vbus = NULL; + } else if (pdata) { type = pdata->type; clk_rate = pdata->clk_rate; @@ -232,19 +233,17 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, if (gpio_is_valid(pdata->gpio_reset)) { err = devm_gpio_request_one(dev, pdata->gpio_reset, 0, dev_name(dev)); - if (!err) - nop->gpiod_reset = - gpio_to_desc(pdata->gpio_reset); + if (err) { + dev_err(dev, "Error requesting RESET GPIO\n"); + return err; + } + nop->gpiod_reset = gpio_to_desc(pdata->gpio_reset); } nop->gpiod_vbus = pdata->gpiod_vbus; } if (err == -EPROBE_DEFER) return -EPROBE_DEFER; - if (err) { - dev_err(dev, "Error requesting RESET GPIO\n"); - return err; - } nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg), GFP_KERNEL); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html