usb: gadget: composite: fix dereference after null check coverify warning

cdev->config is checked for null pointer at above code, so cdev->config
might be null, fix it by adding null pointer check.

Change-Id: Ie919a2a886924f1b1e01415bfdaa53f74046f5b0
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Git-commit: c526c62d565ea5a5bba9433f28756079734f430d
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
Peter Chen 2016-07-01 15:33:28 +08:00 committed by Jack Pham
parent 2d50ef2cf3
commit 19e19a1710

View file

@ -1962,6 +1962,8 @@ unknown:
break;
case USB_RECIP_ENDPOINT:
if (!cdev->config)
break;
endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
list_for_each_entry(f, &cdev->config->functions, list) {
if (test_bit(endp, f->endpoints))