mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] peci: npcm: Initialize state before requesting IRQ
@ 2026-09-02 15:22 Runyu Xiao
  2026-09-17 20:54 ` Winiarska, Iwona
  0 siblings, 1 reply; 2+ messages in thread
From: Runyu Xiao @ 2026-09-02 15:22 UTC (permalink / raw)
  To: Andrew Jeffery
  Cc: Avi Fishman, Tomer Maimon, Tali Perry, Patrick Venture,
	Nancy Yuen, Benjamin Fair, Iwona Winiarska, openbmc,
	linux-kernel, stable, Runyu Xiao, Jianhao Xu

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@vger.kernel.org
Assisted-by: Codex:GPT-5
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 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;
-- 
2.34.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] peci: npcm: Initialize state before requesting IRQ
  2026-09-02 15:22 [PATCH] peci: npcm: Initialize state before requesting IRQ Runyu Xiao
@ 2026-09-17 20:54 ` Winiarska, Iwona
  0 siblings, 0 replies; 2+ messages in thread
From: Winiarska, Iwona @ 2026-09-17 20:54 UTC (permalink / raw)
  To: runyu.xiao, andrew
  Cc: avifishman70, jianhao.xu, benjaminfair, tmaimon77, yuenn,
	venture, linux-kernel, tali.perry1, stable, openbmc

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@vger.kernel.org
> Assisted-by: Codex:GPT-5
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>

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

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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-17 20:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-02 15:22 [PATCH] peci: npcm: Initialize state before requesting IRQ Runyu Xiao
2026-09-17 20:54 ` Winiarska, Iwona

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®