From: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Yuho Choi <dbgh9129@gmail.com>, Thomas Gleixner <tglx@kernel.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v1] irqchip/atmel-aic5: Free SMR cache on init failure
Date: Fri, 15 May 2026 11:58:13 +0200 [thread overview]
Message-ID: <067c55c0-d56c-496e-bf75-5c3491524256@microchip.com> (raw)
In-Reply-To: <20260513233139.659956-1-dbgh9129@gmail.com>
On 14/05/2026 at 01:31, Yuho Choi wrote:
> 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.
No aic5 = no viable system to run on: I'm not sure it's worth
considering the case.
> 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
>
prev parent reply other threads:[~2026-05-15 9:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 23:31 [PATCH v1] irqchip/atmel-aic5: Free SMR cache on init failure Yuho Choi
2026-05-15 9:58 ` Nicolas Ferre [this message]
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=067c55c0-d56c-496e-bf75-5c3491524256@microchip.com \
--to=nicolas.ferre@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=dbgh9129@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--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