All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Chen <ryan_chen@aspeedtech.com>
To: Stefan Schaeckeler <sschaeck@cisco.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Joel Stanley <joel@jms.id.au>,
	Andrew Jeffery <andrew@codeconstruct.com.au>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>
Cc: <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
	<linux-edac@vger.kernel.org>, Borislav Petkov <bp@suse.de>,
	Ryan Chen <ryan_chen@aspeedtech.com>
Subject: [PATCH v5 2/9] EDAC/aspeed: Free the interrupt before the mem_ctl_info on remove
Date: Wed, 7 Oct 2026 14:13:19 +0800	[thread overview]
Message-ID: <20261007-edac-v5-2-5c31fc5df4cf@aspeedtech.com> (raw)
In-Reply-To: <20261007-edac-v5-0-5c31fc5df4cf@aspeedtech.com>

The ECC interrupt is devm-managed, so it is only released after .remove()
has returned, and masking the controller does not wait for a handler
already running on another CPU. edac_mc_free() can therefore free the
mem_ctl_info the handler uses as its context while it is still running.

Register the handler with request_irq() and free it before the memory
it uses. aspeed_probe() returns as soon as config_irq() succeeds, so
devres has no error path left to unwind.

Fixes: 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")
Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>

---
Changes in v5:
- Use request_irq()/free_irq() rather than devm_request_irq() followed
  by an explicit free, and keep the interrupt number in a file-scope
  variable so aspeed_remove() does not have to call platform_get_irq()
  a second time.

Changes in v4:
- Drop the Cc: stable tag.

Changes in v2:
- New patch.
---
 drivers/edac/aspeed_edac.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
index 83d60414f89a..cb233a33d29a 100644
--- a/drivers/edac/aspeed_edac.c
+++ b/drivers/edac/aspeed_edac.c
@@ -36,6 +36,7 @@
 
 
 static struct regmap *aspeed_regmap;
+static int aspeed_irq;
 
 
 static int regmap_reg_write(void *context, unsigned int reg, unsigned int val)
@@ -212,11 +213,12 @@ static int config_irq(void *ctx, struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	rc = devm_request_irq(&pdev->dev, irq, mcr_isr, IRQF_TRIGGER_HIGH,
-			      DRV_NAME, ctx);
+	rc = request_irq(irq, mcr_isr, IRQF_TRIGGER_HIGH, DRV_NAME, ctx);
 	if (rc)
 		return rc;
 
+	aspeed_irq = irq;
+
 	/* enable interrupts */
 	regmap_update_bits(aspeed_regmap, ASPEED_MCR_INTR_CTRL,
 			   ASPEED_MCR_INTR_CTRL_ENABLE,
@@ -364,6 +366,8 @@ static void aspeed_remove(struct platform_device *pdev)
 	regmap_update_bits(aspeed_regmap, ASPEED_MCR_INTR_CTRL,
 			   ASPEED_MCR_INTR_CTRL_ENABLE, 0);
 
+	free_irq(aspeed_irq, platform_get_drvdata(pdev));
+
 	/* free resources */
 	mci = edac_mc_del_mc(&pdev->dev);
 	if (mci)

-- 
2.34.1


  parent reply	other threads:[~2026-10-07  6:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07  6:13 [PATCH v5 0/9] Add Aspeed AST2700 SDRAM EDAC support Ryan Chen
2026-10-07  6:13 ` [PATCH v5 1/9] EDAC/aspeed: Set the DIMM grain Ryan Chen
2026-10-07  6:13 ` Ryan Chen [this message]
2026-10-07  6:13 ` [PATCH v5 3/9] EDAC/aspeed: Clean up whitespace and include ordering Ryan Chen
2026-10-07  6:13 ` [PATCH v5 4/9] EDAC/aspeed: Free the mem_ctl_info unconditionally on remove Ryan Chen
2026-10-07  6:13 ` [PATCH v5 5/9] dt-bindings: edac: aspeed: Add AST2700 SDRAM EDAC Ryan Chen
2026-10-07  6:13 ` [PATCH v5 6/9] EDAC/aspeed: Replace regmap with direct register access Ryan Chen
2026-10-07  6:22   ` sashiko-bot
2026-10-07  6:13 ` [PATCH v5 7/9] EDAC/aspeed: Abstract SoC differences behind chip data Ryan Chen
2026-10-07  6:13 ` [PATCH v5 8/9] EDAC/aspeed: Add AST2700 support Ryan Chen
2026-10-07  6:13 ` [PATCH v5 9/9] MAINTAINERS: Step down as Aspeed AST2500 EDAC driver maintainer Ryan Chen
2026-10-07 20:32   ` Rob Herring (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261007-edac-v5-2-5c31fc5df4cf@aspeedtech.com \
    --to=ryan_chen@aspeedtech.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sschaeck@cisco.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.