[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0g29Gh4JmKkheqkF5MrnbHefq=KVm=ccxHT4+A99LpVfg@mail.gmail.com>
Date: Wed, 18 Oct 2023 13:31:20 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Sunil V L <sunilvl@...tanamicro.com>
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
"Rafael J . Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Hanjun Guo <guohanjun@...wei.com>,
Marc Zyngier <maz@...nel.org>,
Anup Patel <apatel@...tanamicro.com>
Subject: Re: [PATCH] ACPI: irq: Fix the incorrect return value in acpi_register_gsi()
On Wed, Oct 18, 2023 at 1:13 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
>
> On Mon, Oct 16, 2023 at 7:09 PM Sunil V L <sunilvl@...tanamicro.com> wrote:
> >
> > acpi_register_gsi() should return negative value in case of failure.
> > Currently, it returns the return value from irq_create_fwspec_mapping().
> > However, irq_create_fwspec_mapping() returns 0 for failure. Fix the issue
> > by returning -EINVAL if irq_create_fwspec_mapping() returns zero.
> >
> > Fixes: d44fa3d46079 ("ACPI: Add support for ResourceSource/IRQ domain mapping")
> > Signed-off-by: Sunil V L <sunilvl@...tanamicro.com>
> > ---
> > drivers/acpi/irq.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
> > index c2c786eb95ab..403f33df66af 100644
> > --- a/drivers/acpi/irq.c
> > +++ b/drivers/acpi/irq.c
> > @@ -57,6 +57,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
> > int polarity)
> > {
> > struct irq_fwspec fwspec;
> > + unsigned int rc;
> >
> > fwspec.fwnode = acpi_get_gsi_domain_id(gsi);
> > if (WARN_ON(!fwspec.fwnode)) {
> > @@ -68,7 +69,11 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
> > fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity);
> > fwspec.param_count = 2;
> >
> > - return irq_create_fwspec_mapping(&fwspec);
> > + rc = irq_create_fwspec_mapping(&fwspec);
> > + if (!rc)
> > + return -EINVAL;
> > +
> > + return rc;
> > }
> > EXPORT_SYMBOL_GPL(acpi_register_gsi);
> >
> > --
>
> Good catch!
>
> Applied as 6.7 material, but I renamed the new rc local variable to irq.
>
> Thanks!
Actually, I'm going to push this for -rc7.
Powered by blists - more mailing lists