From: Yuho Choi <dbgh9129@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Yuho Choi <dbgh9129@gmail.com>
Subject: [PATCH v1] irqchip/atmel-aic5: Free SMR cache on init failure
Date: Wed, 13 May 2026 19:31:39 -0400 [thread overview]
Message-ID: <20260513233139.659956-1-dbgh9129@gmail.com> (raw)
sama5d2_aic5_of_init() allocates the SMR cache before calling
aic5_of_init(). If that fails, the cache is left allocated even though
no IRQ domain was installed and the cache will not be used.
Free the cache on the failure path and clear the global pointer.
Fixes: a50ac562ef48 ("irqchip/atmel-aic5: Handle suspend to RAM")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/irqchip/irq-atmel-aic5.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c
index 1f14b401f71d..58650eb16880 100644
--- a/drivers/irqchip/irq-atmel-aic5.c
+++ b/drivers/irqchip/irq-atmel-aic5.c
@@ -358,13 +358,22 @@ static int __init sama5d2_aic5_of_init(struct device_node *node,
struct device_node *parent)
{
#ifdef CONFIG_PM
+ int rc = 0;
smr_cache = kcalloc(DIV_ROUND_UP(NR_SAMA5D2_IRQS, 32) * 32,
sizeof(*smr_cache), GFP_KERNEL);
if (!smr_cache)
return -ENOMEM;
-#endif
+ rc = aic5_of_init(node, parent, NR_SAMA5D2_IRQS);
+ if (rc) {
+ kfree(smr_cache);
+ smr_cache = NULL;
+ }
+
+ return rc;
+#else
return aic5_of_init(node, parent, NR_SAMA5D2_IRQS);
+#endif
}
IRQCHIP_DECLARE(sama5d2_aic5, "atmel,sama5d2-aic", sama5d2_aic5_of_init);
--
2.43.0
reply other threads:[~2026-05-13 23:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260513233139.659956-1-dbgh9129@gmail.com \
--to=dbgh9129@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=tglx@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox