mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 03:45:24 -04:00
usb: gadget: Fix setting self-powered state on suspend
commit c783e1258f29c5caac9eea0aea6b172870f1baf8 upstream.
cdev->config might be NULL, so check it before dereferencing.
CC: stable <stable@kernel.org>
Fixes: 40e89ff5750f ("usb: gadget: Set self-powered based on MaxPower and bmAttributes")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20250220120314.3614330-1-m.szyprowski@samsung.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7367e87b6e
commit
9af1d5c4d5
1 changed files with 2 additions and 1 deletions
|
|
@ -2366,7 +2366,8 @@ void composite_suspend(struct usb_gadget *gadget)
|
|||
|
||||
cdev->suspended = 1;
|
||||
|
||||
if (cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER)
|
||||
if (cdev->config &&
|
||||
cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER)
|
||||
usb_gadget_set_selfpowered(gadget);
|
||||
|
||||
usb_gadget_vbus_draw(gadget, 2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue