[PATCH] HSI: omap_ssi: Initialize lock before requesting IRQ

Runyu Xiao posted 1 patch 3 weeks, 6 days ago
drivers/hsi/controllers/omap_ssi_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] HSI: omap_ssi: Initialize lock before requesting IRQ
Posted by Runyu Xiao 3 weeks, 6 days ago
The GDD interrupt handler schedules a tasklet which can eventually use
the controller lock. Initialize the lock before registering the handler
so an early interrupt cannot reach the tasklet with an uninitialized lock.

Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver")
Cc: stable@vger.kernel.org
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/hsi/controllers/omap_ssi_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index 0f5a6f752..dbbb56e81 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -366,6 +366,7 @@ static int ssi_add_controller(struct hsi_controller *ssi,
 	if (err < 0)
 		goto out_err;
 	omap_ssi->gdd_irq = err;
+	spin_lock_init(&omap_ssi->lock);
 	tasklet_init(&omap_ssi->gdd_tasklet, ssi_gdd_tasklet,
 							(unsigned long)ssi);
 	err = devm_request_irq(&ssi->device, omap_ssi->gdd_irq, ssi_gdd_isr,
@@ -396,7 +397,6 @@ static int ssi_add_controller(struct hsi_controller *ssi,
 	omap_ssi->get_loss = NULL;
 
 	omap_ssi->max_speed = UINT_MAX;
-	spin_lock_init(&omap_ssi->lock);
 	err = hsi_register_controller(ssi);
 
 	if (err < 0)
-- 
2.34.1