From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Chen Ni <nichen@iscas.ac.cn>,
linux-kernel@vger.kernel.org
Cc: Lee Jones <lee@kernel.org>
Subject: [PATCH v3 2/2] mfd: intel-lpss: Amend IRQ check
Date: Mon, 6 Nov 2023 20:40:52 +0200 [thread overview]
Message-ID: <20231106184052.1166579-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20231106184052.1166579-1-andriy.shevchenko@linux.intel.com>
From: Chen Ni <nichen@iscas.ac.cn>
platform_get_irq() returns a negative error code to indicating an
error. All the same does pci_alloc_irq_vectors() and pci_irq_vector().
So in intel_lpss_probe() the erroneous IRQ should be better returned
as is.
The pci_alloc_irq_vectors() call and platform_get_irq() guarantee
that IRQ won't be 0, hence drop that check.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
[andy: updated commit message]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mfd/intel-lpss.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 9591b354072a..4c9d0222751a 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -378,9 +378,12 @@ int intel_lpss_probe(struct device *dev,
struct intel_lpss *lpss;
int ret;
- if (!info || !info->mem || info->irq <= 0)
+ if (!info || !info->mem)
return -EINVAL;
+ if (info->irq < 0)
+ return info->irq;
+
lpss = devm_kzalloc(dev, sizeof(*lpss), GFP_KERNEL);
if (!lpss)
return -ENOMEM;
--
2.40.0.1.gaa8946217a0b
next prev parent reply other threads:[~2023-11-06 18:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 18:40 [PATCH v3 0/2] mfd: intel-lpss: refactor PCI probe and common IRQ check Andy Shevchenko
2023-11-06 18:40 ` [PATCH v3 1/2] mfd: intel-lpss: Use PCI APIs instead of derefereincing Andy Shevchenko
2023-11-23 11:17 ` Lee Jones
2023-11-06 18:40 ` Andy Shevchenko [this message]
2023-11-23 11:18 ` [PATCH v3 2/2] mfd: intel-lpss: Amend IRQ check Lee Jones
2023-11-23 11:17 ` [PATCH v3 0/2] mfd: intel-lpss: refactor PCI probe and common " Lee Jones
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=20231106184052.1166579-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nichen@iscas.ac.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox