All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spmi: pmic-arb: Fix of_irq_get_byname() error checking
@ 2024-04-24 11:42 Dan Carpenter
  2024-05-02  0:55 ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2024-04-24 11:42 UTC (permalink / raw)
  To: Abel Vesa; +Cc: Stephen Boyd, Neil Armstrong, linux-kernel, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Fix of_irq_get_byname() error checking
  2024-04-24 11:42 [PATCH] spmi: pmic-arb: Fix of_irq_get_byname() error checking Dan Carpenter
@ 2024-05-02  0:55 ` Stephen Boyd
  2024-05-02  7:08   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2024-05-02  0:55 UTC (permalink / raw)
  To: Abel Vesa, Dan Carpenter; +Cc: Neil Armstrong, linux-kernel, kernel-janitors

Quoting Dan Carpenter (2024-04-24 04:42:46)
> 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")

Sadly this isn't stable because I just send patches over email.

> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Applied to spmi-next

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Fix of_irq_get_byname() error checking
  2024-05-02  0:55 ` Stephen Boyd
@ 2024-05-02  7:08   ` Dan Carpenter
  2024-05-02 22:24     ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2024-05-02  7:08 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Abel Vesa, Neil Armstrong, linux-kernel, kernel-janitors

On Wed, May 01, 2024 at 05:55:03PM -0700, Stephen Boyd wrote:
> Quoting Dan Carpenter (2024-04-24 04:42:46)
> > 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")
> 
> Sadly this isn't stable because I just send patches over email.
> 

If you're going to send these as email then you should fold it into the
original commit or otherwise people will be confused.

> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> 
> Applied to spmi-next

Thanks!

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Fix of_irq_get_byname() error checking
  2024-05-02  7:08   ` Dan Carpenter
@ 2024-05-02 22:24     ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2024-05-02 22:24 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Abel Vesa, Neil Armstrong, linux-kernel, kernel-janitors

Quoting Dan Carpenter (2024-05-02 00:08:29)
> On Wed, May 01, 2024 at 05:55:03PM -0700, Stephen Boyd wrote:
> > Quoting Dan Carpenter (2024-04-24 04:42:46)
> > > 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")
> > 
> > Sadly this isn't stable because I just send patches over email.
> > 
> 
> If you're going to send these as email then you should fold it into the
> original commit or otherwise people will be confused.

I removed the fixes tag. I will fold it in with your SoB, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-02 22:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 11:42 [PATCH] spmi: pmic-arb: Fix of_irq_get_byname() error checking Dan Carpenter
2024-05-02  0:55 ` Stephen Boyd
2024-05-02  7:08   ` Dan Carpenter
2024-05-02 22:24     ` Stephen Boyd

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.