Re: usb: dwc2: gadget: Do not fail probe if there isn't a clock node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 24, 2014 at 01:46:56PM +0300, Dan Carpenter wrote:
> Hello Dinh Nguyen,
> 
> The patch 8d736d8a9c44: "usb: dwc2: gadget: Do not fail probe if
> there isn't a clock node" from Nov 11, 2014, leads to the following
> static checker warning:
> 
> 	drivers/usb/dwc2/gadget.c:3436 dwc2_gadget_init()
> 	warn: passing zero to 'PTR_ERR'
> 
> drivers/usb/dwc2/gadget.c
>   3432          hsotg->clk = devm_clk_get(dev, "otg");
>   3433          if (IS_ERR(hsotg->clk)) {
>   3434                  hsotg->clk = NULL;
> 
> You need to preserve the error code.  NULL means zero means success.
> 

Oh, wait.  You are returning success deliberately?  Just "return 0;"
in that case instead of obfuscating it this way.  But shouldn't we
continue with the rest of the function anyway?  This patch is confusing
to me.

>   3435                  dev_err(dev, "cannot get otg clock\n");

Do we need to print this error if it's a success path?

What?

regards,
dan carpenter

--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux