> -----Original Message-----
> From: Dan Carpenter [mailto:[email protected]]
> Sent: Friday, November 01, 2013 6:33 PM
> To: Chen Peter-B29397
> Cc: [email protected]
> Subject: re: usb: chipidea: host: add vbus regulator control
> 
> Hello Peter Chen,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 40ed51a4b858: "usb: chipidea: host: add vbus regulator
> control" from Aug 14, 2013, leads to the following Smatch complaint:
> 
> drivers/usb/chipidea/host.c:91 host_start()
>        error: we previously assumed 'ci->platdata->reg_vbus' could be
> null (see line 69)
> 
> drivers/usb/chipidea/host.c
>     68
>     69                if (ci->platdata->reg_vbus) {
>                     ^^^^^^^^^^^^^^^^^^^^^^
> Patch introduces a new NULL check.
> 
>     70                        ret = regulator_enable(ci->platdata->reg_vbus);
>     71                        if (ret) {
>     72                                dev_err(ci->dev,
>     73                                        "Failed to enable vbus 
> regulator,
> ret=%d\n",
>     74                                        ret);
>     75                                goto put_hcd;
>     76                        }
>     77                }
>     78
>     79                ret = usb_add_hcd(hcd, 0, 0);
>     80                if (ret)
>     81                        goto disable_reg;
>     82                else
>     83                        ci->hcd = hcd;
>     84
>     85                if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
>     86                        hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> USBMODE_CI_SDIS);
>     87
>     88                return ret;
>     89
>     90        disable_reg:
>     91                regulator_disable(ci->platdata->reg_vbus);
>                                   ^^^^^^^^^^^^^^^^^^^^^^
> Patch introduces a new unchecked NULL dereference.
> 
>     92
>     93        put_hcd:
> 

Thanks, Dan. I will send a patch to fix it.

Peter

> regards,
> dan carpenter


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to