All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Shurong <zhang_shurong@foxmail.com>
To: ldewangan@nvidia.com
Cc: broonie@kernel.org, thierry.reding@gmail.com,
	jonathanh@nvidia.com, p.zabel@pengutronix.de,
	sumit.semwal@linaro.org, christian.koenig@amd.com,
	linux-spi@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	Zhang Shurong <zhang_shurong@foxmail.com>
Subject: [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe()
Date: Sat, 26 Aug 2023 18:02:54 +0800	[thread overview]
Message-ID: <tencent_73FCC06A3D1C14EE5175253C6FB46A07B709@qq.com> (raw)

This func misses checking for platform_get_irq()'s call and may passes the
negative error codes to request_irq(), which takes unsigned IRQ #,
causing it to fail with -EINVAL, overriding an original error code.

Fix this by stop calling request_irq() with invalid IRQ #s.

Fixes: dc4dc3605639 ("spi: tegra: add spi driver for SLINK controller")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
 drivers/spi/spi-tegra20-slink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 4d6db6182c5e..f5cd365c913a 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -1086,6 +1086,8 @@ 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;
 	tspi->irq = spi_irq;
 	ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
 				   tegra_slink_isr_thread, IRQF_ONESHOT,
-- 
2.30.2


WARNING: multiple messages have this Message-ID (diff)
From: Zhang Shurong <zhang_shurong@foxmail.com>
To: ldewangan@nvidia.com
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, sumit.semwal@linaro.org,
	linaro-mm-sig@lists.linaro.org, broonie@kernel.org,
	thierry.reding@gmail.com, linux-tegra@vger.kernel.org,
	jonathanh@nvidia.com, Zhang Shurong <zhang_shurong@foxmail.com>,
	christian.koenig@amd.com, linux-media@vger.kernel.org
Subject: [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe()
Date: Sat, 26 Aug 2023 18:02:54 +0800	[thread overview]
Message-ID: <tencent_73FCC06A3D1C14EE5175253C6FB46A07B709@qq.com> (raw)

This func misses checking for platform_get_irq()'s call and may passes the
negative error codes to request_irq(), which takes unsigned IRQ #,
causing it to fail with -EINVAL, overriding an original error code.

Fix this by stop calling request_irq() with invalid IRQ #s.

Fixes: dc4dc3605639 ("spi: tegra: add spi driver for SLINK controller")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
 drivers/spi/spi-tegra20-slink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 4d6db6182c5e..f5cd365c913a 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -1086,6 +1086,8 @@ 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;
 	tspi->irq = spi_irq;
 	ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
 				   tegra_slink_isr_thread, IRQF_ONESHOT,
-- 
2.30.2


             reply	other threads:[~2023-08-26 10:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-26 10:02 Zhang Shurong [this message]
2023-08-26 10:02 ` [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe() Zhang Shurong
2023-08-28 15:32 ` Helen Mae Koike Fornazier
2023-08-28 15:32   ` Helen Mae Koike Fornazier
2023-09-12 11:38 ` Mark Brown
2023-09-12 11:38   ` 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=tencent_73FCC06A3D1C14EE5175253C6FB46A07B709@qq.com \
    --to=zhang_shurong@foxmail.com \
    --cc=broonie@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=sumit.semwal@linaro.org \
    --cc=thierry.reding@gmail.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.