[PATCH] media: platform: rzg2l-cru: Initialize lock before requesting IRQ

From: Runyu Xiao

Date: Sun Aug 30 2026 - 11:13:15 EST


rzg2l_cru_probe() requests the CRU interrupt before calling
rzg2l_cru_dma_register(). The latter initializes cru->hw_lock, which is
acquired by the IRQ handlers.

An interrupt can be delivered as soon as devm_request_irq() succeeds, so
the handler can observe hw_lock before it has been initialized. Initialize
hw_lock before requesting the IRQ and remove the later duplicate
initialization.

Fixes: 0c200daa5780 ("media: platform: rzg2l-cru: rzg2l-video: Move request_irq() to probe()")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Runyu Xiao <runyu.xiao@xxxxxxxxxx>
Assisted-by: Codex:GPT-5
---
drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c | 1 +
drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
index 798ef2916..3edb9d3c4 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
@@ -269,6 +269,7 @@ static int rzg2l_cru_probe(struct platform_device *pdev)

cru->dev = dev;
cru->info = of_device_get_match_data(dev);
+ spin_lock_init(&cru->hw_lock);

irq = platform_get_irq(pdev, 0);
if (irq < 0)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
index 91eda5034..a92d87d53 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
@@ -784,7 +784,6 @@ int rzg2l_cru_dma_register(struct rzg2l_cru_dev *cru)
mutex_init(&cru->lock);
INIT_LIST_HEAD(&cru->buf_list);

- spin_lock_init(&cru->hw_lock);
spin_lock_init(&cru->qlock);

for (i = 0; i < RZG2L_CRU_HW_BUFFER_MAX; i++)
--
2.34.1