fix(drivers/usb): fix Null pointer dereferences in usb_core_set_config

Correct the invalid test on NULL pointer pdev->class in
usb_core_set_config function.

This patch fix the coverity errors:

  ** CID 373790:  Null pointer dereferences  (FORWARD_NULL)
  /drivers/usb/usb_device.c: 182 in usb_core_set_config()

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I83e43261bafa2d47f800e56df0b047a6c58a1e29
This commit is contained in:
Patrick Delaunay 2021-11-02 11:09:12 +01:00
parent 89ff55fef4
commit 0cb9870ddf
1 changed files with 1 additions and 1 deletions

View File

@ -174,7 +174,7 @@ static void usb_core_set_config(struct usb_handle *pdev, struct usb_setup_req *r
pdev->dev_config = cfgidx;
pdev->class->de_init(pdev, cfgidx);
} else if (cfgidx != pdev->dev_config) {
if (pdev->class != NULL) {
if (pdev->class == NULL) {
usb_core_ctl_error(pdev);
return;
}