From: Jon Hunter <jonathanh@nvidia.com>
To: Felix Gu <ustc.gu@gmail.com>,
Laxman Dewangan <ldewangan@nvidia.com>,
Mark Brown <broonie@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Zhang Shurong <zhang_shurong@foxmail.com>,
Helen Koike <helen.koike@collabora.com>
Cc: linux-spi@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: tegra: Fix a memory leak in tegra_slink_probe()
Date: Mon, 2 Feb 2026 15:38:40 +0000 [thread overview]
Message-ID: <dac06237-7684-43e8-a414-f9728cd60365@nvidia.com> (raw)
In-Reply-To: <20260202-slink-v1-1-eac50433a6f9@gmail.com>
On 02/02/2026 15:15, Felix Gu wrote:
> In tegra_slink_probe(), when platform_get_irq() fails, it directly
> returns from the function with an error code, which causes a memory leak.
>
> Replace it with a goto label to ensure proper cleanup.
>
> Fixes: eb9913b511f1 ("spi: tegra: Fix missing IRQ check in tegra_slink_probe()")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> drivers/spi/spi-tegra20-slink.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
> index 7d6f3fe8b7e3..8c608abd6076 100644
> --- a/drivers/spi/spi-tegra20-slink.c
> +++ b/drivers/spi/spi-tegra20-slink.c
> @@ -1086,8 +1086,10 @@ static int tegra_slink_probe(struct platform_device *pdev)
> reset_control_deassert(tspi->rst);
>
> spi_irq = platform_get_irq(pdev, 0);
> - if (spi_irq < 0)
> - return spi_irq;
> + if (spi_irq < 0) {
> + ret = spi_irq;
> + goto exit_pm_put;
> + }
> tspi->irq = spi_irq;
> ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
> tegra_slink_isr_thread, IRQF_ONESHOT,
>
> ---
> base-commit: 4c87cdd0328495759f6e9f9f4e1e53ef8032a76f
> change-id: 20260202-slink-a229f708611d
We could get rid of this 'spi_irq' variable and just use 'ret', but that
is another clean-up. Otherwise ...
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Thanks
Jon
--
nvpublic
next prev parent reply other threads:[~2026-02-02 15:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 15:15 Felix Gu
2026-02-02 15:38 ` Jon Hunter [this message]
2026-02-02 23:33 ` Mark Brown
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=dac06237-7684-43e8-a414-f9728cd60365@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=broonie@kernel.org \
--cc=helen.koike@collabora.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=ustc.gu@gmail.com \
--cc=zhang_shurong@foxmail.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 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®