Hi,

On Tue, Jan 27, 2015 at 07:17:57PM -0200, Fabio Estevam wrote:
> On Tue, Jan 27, 2015 at 6:03 PM, Felipe Balbi <ba...@ti.com> wrote:
> 
> > wrong test, you should use IS_ERR(), NULL is a valid gpio descriptor.
> 
> Ok, here we go:
> 
> --- a/drivers/usb/phy/phy-generic.c
> +++ b/drivers/usb/phy/phy-generic.c
> @@ -218,11 +218,13 @@ int usb_phy_gen_create_phy(struct device *dev, struct 
> usb_
>                         clk_rate = 0;
> 
>                 needs_vcc = of_property_read_bool(node, "vcc-supply");
> -               nop->gpiod_reset = devm_gpiod_get(dev, "reset-gpios");
> +               nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset");
> +               if (IS_ERR(nop->gpiod_reset))
> +                       pr_err("******* failed to retrieve reset-gpios\n");
>                 err = PTR_ERR(nop->gpiod_reset);
>                 if (!err) {
> -                       nop->gpiod_vbus = devm_gpiod_get(dev,
> -                                                        "vbus-detect-gpio");
> +                       nop->gpiod_vbus = devm_gpiod_get_optional(dev,
> +                                                        "vbus-detect");
>                         err = PTR_ERR(nop->gpiod_vbus);
>                 }
>         } else if (pdata) {
> 
> 
> which leads to:
> 
> [    0.126378] usbcore: registered new interface driver hub
> [    0.126617] usbcore: registered new device driver usb
> [    0.127025] usbphy:usbphy@0 supply vcc not found, using dummy regulator
> [    0.127588] usb_phy_generic usbphy:usbh1phy@0: Error requesting RESET GPIO
> [    0.127677] usb_phy_generic: probe of usbphy:usbh1phy@0 failed with
> error -1643301316

weird, that seems to be a valid pointer. Can you try below:


diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index 9a826ff31951..34231c31cd1a 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -219,11 +219,11 @@ 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_optional(dev, "reset-gpios");
-               err = PTR_ERR(nop->gpiod_reset);
+               err = PTR_ERR_OR_ZERO(nop->gpiod_reset);
                if (!err) {
                        nop->gpiod_vbus = devm_gpiod_get_optional(dev,
                                                         "vbus-detect-gpio");
-                       err = PTR_ERR(nop->gpiod_vbus);
+                       err = PTR_ERR_OR_ZERO(nop->gpiod_vbus);
                }
        } else if (pdata) {
                type = pdata->type;

-- 
balbi

Attachment: signature.asc
Description: Digital signature

Reply via email to