Subject: Re: net: qmi_wwan: bind to both control and data interface

From: Bjørn Mork <[email-masked]>
Date: Fri, 22 Jun 2012 18:27:17 +0200

Dan Carpenter <[email-masked]> writes:

> The patch 230718bda1be: "net: qmi_wwan: bind to both control and data 
> interface" from Jun 19, 2012, leads to the following Smatch warning:
> drivers/net/usb/qmi_wwan.c:206 qmi_wwan_bind()
> 	 error: potential NULL dereference 'cdc_union'.
>
> drivers/net/usb/qmi_wwan.c
>    205          /* verify CDC Union */
>    206          if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) {
>                                               ^^^^^^^^^
>
> cdc_union is only non-NULL for USB_CDC_UNION_TYPE.  We used to check for
> NULL here but your patch removes the check.  I just want to verify that
> that was intended.
>
>    207                  dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0);
>    208                  goto err;
>    209          }
>    210  

Thanks for the notification, but this was intentional while touching the
code anyway.  The test always was redundant because the parsing code
ensure that cdc_union cannot be NULL at that point.

Bjørn