Re: [PATCH] peci: npcm: Initialize state before requesting IRQ

From: Winiarska, Iwona

Date: Thu Sep 17 2026 - 17:00:17 EST


On Wed, 2026-09-02 at 23:22 +0800, Runyu Xiao wrote:
> The PECI interrupt handler uses the lock and completion object as soon as
> the interrupt is delivered. Initialize both before registering the
> handler so an early interrupt cannot access uninitialized state.
>
> Fixes: 3e16184a1bd8 ("peci: Add peci-npcm controller driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: Codex:GPT-5
> Signed-off-by: Runyu Xiao <runyu.xiao@xxxxxxxxxx>

Reviewed-by: Iwona Winiarska <iwona.winiarska@xxxxxxxxx>

Thanks
-Iwona

> ---
>  drivers/peci/controller/peci-npcm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/peci/controller/peci-npcm.c
> b/drivers/peci/controller/peci-npcm.c
> index 931868991..3cc4e959a 100644
> --- a/drivers/peci/controller/peci-npcm.c
> +++ b/drivers/peci/controller/peci-npcm.c
> @@ -253,14 +253,14 @@ static int npcm_peci_probe(struct platform_device *pdev)
>   if (priv->irq < 0)
>   return priv->irq;
>  
> + init_completion(&priv->xfer_complete);
> + spin_lock_init(&priv->lock);
> +
>   ret = devm_request_irq(&pdev->dev, priv->irq, npcm_peci_irq_handler,
>          0, "peci-npcm-irq", priv);
>   if (ret)
>   return ret;
>  
> - init_completion(&priv->xfer_complete);
> - spin_lock_init(&priv->lock);
> -
>   ret = npcm_peci_init_ctrl(priv);
>   if (ret)
>   return ret;