From: Dan Carpenter <dan.carpenter@linaro.org>
To: Abel Vesa <abel.vesa@linaro.org>
Cc: Stephen Boyd <sboyd@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] spmi: pmic-arb: Fix of_irq_get_byname() error checking
Date: Wed, 24 Apr 2024 14:42:46 +0300 [thread overview]
Message-ID: <53c31752-c8a2-4098-837e-2f84f03c8748@moroto.mountain> (raw)
There are two bugs in this code:
1) The "irq" variable needs to be signed for the error handling to
work.
2) The of_irq_get_byname() also returns zero on error so change the
comparison from < 0 to <= 0.
Fixes: 932282f154ac ("spmi: pmic-arb: Register controller for bus instead of arbiter")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/spmi/spmi-pmic-arb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 0a17ff02c827..791cdc160c51 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -1672,7 +1672,7 @@ static int spmi_pmic_arb_bus_init(struct platform_device *pdev,
void __iomem *intr;
void __iomem *cnfg;
int index, ret;
- u32 irq;
+ int irq;
ctrl = devm_spmi_controller_alloc(dev, sizeof(*bus));
if (IS_ERR(ctrl))
@@ -1721,8 +1721,8 @@ static int spmi_pmic_arb_bus_init(struct platform_device *pdev,
return PTR_ERR(intr);
irq = of_irq_get_byname(node, "periph_irq");
- if (irq < 0)
- return irq;
+ if (irq <= 0)
+ return irq ?: -ENXIO;
bus->pmic_arb = pmic_arb;
bus->intr = intr;
--
2.43.0
next reply other threads:[~2024-04-24 11:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 11:42 Dan Carpenter [this message]
2024-05-02 0:55 ` Stephen Boyd
2024-05-02 7:08 ` Dan Carpenter
2024-05-02 22:24 ` Stephen Boyd
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=53c31752-c8a2-4098-837e-2f84f03c8748@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=abel.vesa@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=sboyd@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
all inboxes | Powered by JetHome®