[PATCH] DWC2: intializes the spin_lock earlier in the probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The spinlock hsotg->lock is intialized at the end of the probe. However it
may be used from within dwc2_hcd_init(). This patch moves the
initialization before the call to dwc2_hcd_init(). This make the locking
correctness validator happy.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@xxxxxxxxxxxxxxx>
---
 drivers/usb/dwc2/platform.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 37a8ab0..55fb30d 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -156,6 +156,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
 		params.dma_desc_enable = prop;
 	}
 
+	spin_lock_init(&hsotg->lock);
+
 	if (IS_ENABLED(CONFIG_USB_DWC2_HOST)) {
 		retval = dwc2_hcd_init(hsotg, irq, &params);
 		if (retval)
@@ -175,7 +177,6 @@ static int dwc2_driver_probe(struct platform_device *dev)
 		if (retval)
 			return retval;
 	}
-	spin_lock_init(&hsotg->lock);
 
 	platform_set_drvdata(dev, hsotg);
 	return retval;
-- 
1.9.2

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux