Commit 069b000c authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: usb_dvobj_init(): A NULL pointer check for usb_host_endpoints makes no sense

struct usb_host_interface points to an array of
struct usb_host_endpoints - it makes no sense to do a NULL pointer
check for each pointer.
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef4c6535
...@@ -80,11 +80,9 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) ...@@ -80,11 +80,9 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
struct usb_config_descriptor *pconf_desc; struct usb_config_descriptor *pconf_desc;
struct usb_host_interface *phost_iface; struct usb_host_interface *phost_iface;
struct usb_interface_descriptor *piface_desc; struct usb_interface_descriptor *piface_desc;
struct usb_host_endpoint *phost_endp;
struct usb_endpoint_descriptor *pendp_desc; struct usb_endpoint_descriptor *pendp_desc;
struct usb_device *pusbd; struct usb_device *pusbd;
int i; int i, status = _FAIL;
int status = _FAIL;
pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL); pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL);
if (!pdvobjpriv) if (!pdvobjpriv)
...@@ -114,14 +112,11 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) ...@@ -114,14 +112,11 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints; pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints;
for (i = 0; i < pdvobjpriv->nr_endpoint; i++) { for (i = 0; i < pdvobjpriv->nr_endpoint; i++) {
phost_endp = phost_iface->endpoint + i; pendp_desc = &phost_iface->endpoint[i].desc;
if (phost_endp) {
pendp_desc = &phost_endp->desc;
DBG_8723A("\nusb_endpoint_descriptor(%d):\n", i); DBG_8723A("\nusb_endpoint_descriptor(%d):\n", i);
DBG_8723A("bLength =%x\n", pendp_desc->bLength); DBG_8723A("bLength =%x\n", pendp_desc->bLength);
DBG_8723A("bDescriptorType =%x\n", DBG_8723A("bDescriptorType =%x\n", pendp_desc->bDescriptorType);
pendp_desc->bDescriptorType);
DBG_8723A("bEndpointAddress =%x\n", DBG_8723A("bEndpointAddress =%x\n",
pendp_desc->bEndpointAddress); pendp_desc->bEndpointAddress);
DBG_8723A("wMaxPacketSize =%d\n", DBG_8723A("wMaxPacketSize =%d\n",
...@@ -135,8 +130,8 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) ...@@ -135,8 +130,8 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
usb_endpoint_num(pendp_desc); usb_endpoint_num(pendp_desc);
pdvobjpriv->RtNumInPipes++; pdvobjpriv->RtNumInPipes++;
} else if (usb_endpoint_is_int_in(pendp_desc)) { } else if (usb_endpoint_is_int_in(pendp_desc)) {
DBG_8723A("usb_endpoint_is_int_in = %x, Interval = %x\n", DBG_8723A("usb_endpoint_is_int_in = %x, Interval = "
usb_endpoint_num(pendp_desc), "%x\n", usb_endpoint_num(pendp_desc),
pendp_desc->bInterval); pendp_desc->bInterval);
pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] =
usb_endpoint_num(pendp_desc); usb_endpoint_num(pendp_desc);
...@@ -150,7 +145,6 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) ...@@ -150,7 +145,6 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
} }
pdvobjpriv->ep_num[i] = usb_endpoint_num(pendp_desc); pdvobjpriv->ep_num[i] = usb_endpoint_num(pendp_desc);
} }
}
DBG_8723A("nr_endpoint =%d, in_num =%d, out_num =%d\n\n", DBG_8723A("nr_endpoint =%d, in_num =%d, out_num =%d\n\n",
pdvobjpriv->nr_endpoint, pdvobjpriv->RtNumInPipes, pdvobjpriv->nr_endpoint, pdvobjpriv->RtNumInPipes,
pdvobjpriv->RtNumOutPipes); pdvobjpriv->RtNumOutPipes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment