On Mon, 18 Aug 2014, Peter Chen wrote:

> linux-2.6/drivers/usb/core/hub.c: In function 'usb_disconnect':
> linux-2.6/drivers/usb/core/hub.c:2110: warning: 'hub' may be used 
> uninitialized in this function
> linux-2.6/drivers/usb/core/hub.c:2111: warning: 'port1' may be used 
> uninitialized in this function
> 
> Signed-off-by: Peter Chen <[email protected]>
> ---
>  drivers/usb/core/hub.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 1fcad4d..6ff960f 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2108,8 +2108,8 @@ void usb_disconnect(struct usb_device **pdev)
>  {
>       struct usb_port *port_dev = NULL;
>       struct usb_device *udev = *pdev;
> -     struct usb_hub *hub;
> -     int port1;
> +     struct usb_hub *hub = NULL;
> +     int port1 = 1;
>  
>       /* mark the device as inactive, so any further urb submissions for
>        * this device (and any of its children) will fail immediately.
> @@ -2166,7 +2166,8 @@ void usb_disconnect(struct usb_device **pdev)
>       *pdev = NULL;
>       spin_unlock_irq(&device_state_lock);
>  
> -     if (port_dev && test_and_clear_bit(port1, hub->child_usage_bits))
> +     if (port_dev && hub &&
> +                     test_and_clear_bit(port1, hub->child_usage_bits))
>               pm_runtime_put(&port_dev->dev);

This hunk isn't needed.  If port_dev is non-NULL then hub must be 
non-NULL also.

Alan Stern

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