From: Dinh Nguyen <dingu...@opensource.altera.com>

The Host workqueue will not get initialized if the driver is configured for
peripheral mode only. Thus we need to check for wq_otg before calling
queue_work().

Signed-off-by: Dinh Nguyen <dingu...@opensource.altera.com>
Acked-by: Paul Zimmerman <pa...@synopsys.com>
---
 drivers/usb/dwc2/core_intr.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
index 651785d..1240875 100644
--- a/drivers/usb/dwc2/core_intr.c
+++ b/drivers/usb/dwc2/core_intr.c
@@ -287,9 +287,11 @@ static void dwc2_handle_conn_id_status_change_intr(struct 
dwc2_hsotg *hsotg)
         * Release lock before scheduling workq as it holds spinlock during
         * scheduling.
         */
-       spin_unlock(&hsotg->lock);
-       queue_work(hsotg->wq_otg, &hsotg->wf_otg);
-       spin_lock(&hsotg->lock);
+       if (hsotg->wq_otg) {
+               spin_unlock(&hsotg->lock);
+               queue_work(hsotg->wq_otg, &hsotg->wf_otg);
+               spin_lock(&hsotg->lock);
+       }
 
        /* Clear interrupt */
        writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS);
-- 
2.0.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to