usb: gadget: composite: add null pointer check
The cdev->config means the currently active configuration and it might be null, fix it by adding null pointer check. Change-Id: I18261653436186c342b447c24ef46a8acc42825f Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
parent
87f9541a89
commit
1bca07a1ff
|
|
@ -958,10 +958,14 @@ unknown:
|
||||||
*/
|
*/
|
||||||
switch (ctrl->bRequestType & USB_RECIP_MASK) {
|
switch (ctrl->bRequestType & USB_RECIP_MASK) {
|
||||||
case USB_RECIP_INTERFACE:
|
case USB_RECIP_INTERFACE:
|
||||||
|
if (!cdev->config)
|
||||||
|
break;
|
||||||
f = cdev->config->interface[intf];
|
f = cdev->config->interface[intf];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_RECIP_ENDPOINT:
|
case USB_RECIP_ENDPOINT:
|
||||||
|
if (!cdev->config)
|
||||||
|
break;
|
||||||
endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
|
endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
|
||||||
list_for_each_entry(f, &cdev->config->functions, list) {
|
list_for_each_entry(f, &cdev->config->functions, list) {
|
||||||
if (test_bit(endp, f->endpoints))
|
if (test_bit(endp, f->endpoints))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue