[PATCH] ASoC: sti: initialize player IRQ lock before requesting IRQ

Runyu Xiao <[email protected]>
Newsgroups gmane.linux.kernel.stable,gmane.linux.sound,gmane.linux.kernel
Message-ID <[email protected]>
uni_player_init() registers the shared IRQ before initializing
player->irq_lock. A pending interrupt can invoke the handler while
the lock is still uninitialized.

Initialize the IRQ lock before registering the handler so the interrupt
path always sees valid lock state.

Fixes: d05d862ead8e ("ASoC: STI: Fix null ptr deference in IRQ handler")
Cc: [email protected]
Assisted-by: Codex:GPT-5
Signed-off-by: Runyu Xiao <[email protected]>
---
 sound/soc/sti/uniperif_player.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c
index e4b9799ad..3537dd209 100644
--- a/sound/soc/sti/uniperif_player.c
+++ b/sound/soc/sti/uniperif_player.c
@@ -1095,6 +1095,8 @@ int uni_player_init(struct platform_device *pdev,
 		}
 	}
 
+	spin_lock_init(&player->irq_lock);
+
 	ret = devm_request_irq(&pdev->dev, player->irq,
 			       uni_player_irq_handler, IRQF_SHARED,
 			       dev_name(&pdev->dev), player);
@@ -1104,8 +1106,6 @@ int uni_player_init(struct platform_device *pdev,
 	}
 
 	mutex_init(&player->ctrl_lock);
-	spin_lock_init(&player->irq_lock);
-
 	/* Ensure that disabled by default */
 	SET_UNIPERIF_CONFIG_BACK_STALL_REQ_DISABLE(player);
 	SET_UNIPERIF_CTRL_ROUNDING_OFF(player);
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.