mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 03:27:03 +02:00
dwc3-msm-core: Add NULL check with dwc3_msm_override_pm_ops() API
dwc3 msm core driver shall start USB host or device mode with dwc3 controller driver. This shall fail specifically USB host mode due to any error with xhci controller initialization. In this case HCD would be unbinded causing NULL pointer deference when trying to override its PM ops with dwc3_msm_override_pm_ops() API. To avoid NULL pointer dereference add NULL check with dwc3_msm_override_pm_ops() API. Change-Id: Ia96e945d58b1bf1d5434b004ac3d3090b24c6208 Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
This commit is contained in:
parent
3912c8275c
commit
727bbb3139
|
|
@ -5329,6 +5329,11 @@ static void dwc3_core_complete(struct device *dev);
|
|||
static void dwc3_msm_override_pm_ops(struct device *dev, struct dev_pm_ops *pm_ops,
|
||||
bool is_host)
|
||||
{
|
||||
if (!dev->driver || !dev->driver->pm) {
|
||||
dev_err(dev, "can't override PM OPs\n");
|
||||
return;
|
||||
}
|
||||
|
||||
(*pm_ops) = (*dev->driver->pm);
|
||||
pm_ops->prepare = is_host ? dwc3_host_prepare : dwc3_core_prepare;
|
||||
pm_ops->complete = is_host ? dwc3_host_complete : dwc3_core_complete;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user