All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiajun Cao <jjcao20@fudan.edu.cn>
To: unlisted-recipients:; (no To-header on input)
Cc: yuanxzhang@fudan.edu.cn, Jiajun Cao <jjcao20@fudan.edu.cn>,
	Xin Tan <tanxin.ctf@gmail.com>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Dmitry Osipenko <digetx@gmail.com>,
	Mohan Kumar <mkumard@nvidia.com>,
	Peter Geis <pgwipeout@gmail.com>,
	alsa-devel@alsa-project.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] pci: hda: Add IRQ check for platform_get_irq()
Date: Tue, 22 Jun 2021 21:19:42 +0800	[thread overview]
Message-ID: <20210622131947.94346-1-jjcao20@fudan.edu.cn> (raw)

The function hda_tegra_first_init() neglects to check the return
value after executing platform_get_irq().

hda_tegra_first_init() should check the return value (if negative
error number) for errors so as to not pass a negative value to
the devm_request_irq().

Fix it by adding a check for the return value irq_id.

Signed-off-by: Jiajun Cao <jjcao20@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
---
 sound/pci/hda/hda_tegra.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
index 6f2b743b9d75..6c6dc3fcde60 100644
--- a/sound/pci/hda/hda_tegra.c
+++ b/sound/pci/hda/hda_tegra.c
@@ -262,6 +262,9 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
 	const char *sname, *drv_name = "tegra-hda";
 	struct device_node *np = pdev->dev.of_node;
 
+	if (irq_id < 0)
+		return irq_id;
+
 	err = hda_tegra_init_chip(chip, pdev);
 	if (err)
 		return err;
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Jiajun Cao <jjcao20@fudan.edu.cn>
Cc: Xin Tan <tanxin.ctf@gmail.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	yuanxzhang@fudan.edu.cn, Takashi Iwai <tiwai@suse.com>,
	Jiajun Cao <jjcao20@fudan.edu.cn>,
	Thierry Reding <thierry.reding@gmail.com>,
	Peter Geis <pgwipeout@gmail.com>,
	linux-tegra@vger.kernel.org, Dmitry Osipenko <digetx@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Mohan Kumar <mkumard@nvidia.com>
Subject: [PATCH] pci: hda: Add IRQ check for platform_get_irq()
Date: Tue, 22 Jun 2021 21:19:42 +0800	[thread overview]
Message-ID: <20210622131947.94346-1-jjcao20@fudan.edu.cn> (raw)

The function hda_tegra_first_init() neglects to check the return
value after executing platform_get_irq().

hda_tegra_first_init() should check the return value (if negative
error number) for errors so as to not pass a negative value to
the devm_request_irq().

Fix it by adding a check for the return value irq_id.

Signed-off-by: Jiajun Cao <jjcao20@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
---
 sound/pci/hda/hda_tegra.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
index 6f2b743b9d75..6c6dc3fcde60 100644
--- a/sound/pci/hda/hda_tegra.c
+++ b/sound/pci/hda/hda_tegra.c
@@ -262,6 +262,9 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
 	const char *sname, *drv_name = "tegra-hda";
 	struct device_node *np = pdev->dev.of_node;
 
+	if (irq_id < 0)
+		return irq_id;
+
 	err = hda_tegra_init_chip(chip, pdev);
 	if (err)
 		return err;
-- 
2.17.1


             reply	other threads:[~2021-06-22 13:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 13:19 Jiajun Cao [this message]
2021-06-22 13:19 ` [PATCH] pci: hda: Add IRQ check for platform_get_irq() Jiajun Cao
2021-06-22 14:08 ` Thierry Reding
2021-06-22 14:08   ` Thierry Reding
2021-06-22 14:12 ` Takashi Iwai
2021-06-22 14:12   ` Takashi Iwai

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=20210622131947.94346-1-jjcao20@fudan.edu.cn \
    --to=jjcao20@fudan.edu.cn \
    --cc=alsa-devel@alsa-project.org \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mkumard@nvidia.com \
    --cc=perex@perex.cz \
    --cc=pgwipeout@gmail.com \
    --cc=tanxin.ctf@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    --cc=yuanxzhang@fudan.edu.cn \
    /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.