Re: [PATCH v4] gpio: Add support for Intel SoC PMIC (Crystal Cove)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 30, 2014 at 4:12 AM, Zhu, Lejun <lejun.zhu@xxxxxxxxxxxxxxx> wrote:

>         retval = gpiochip_add(&cg->chip);
>         if (retval) {
>                 dev_warn(&pdev->dev, "add gpio chip error: %d\n", retval);
>                 return ret;
>         }
>
>         gpiochip_irqchip_add(&cg->chip, &crystalcove_irqchip, 0,
>                              handle_simple_irq, IRQ_TYPE_NONE);
>
>         retval = request_threaded_irq(irq, NULL, crystalcove_gpio_irq_handler,
>                                       IRQF_ONESHOT, KBUILD_MODNAME, cg);

You should request the interrupt before you add the irqchip
I think. But it shouldn't really matter, mainly to avoid tearing
down the irqchip if getting the irq should fail.

> But this code will trigger a crash in gpiolib-acpi. Currently at the end
> of gpiochip_add(), it calls:
>
> gpiochip_add() -> acpi_gpiochip_add() -> acpi_gpiochip_request_interrupts()
>
> acpi_gpiochip_request_interrupts() needs ->to_irq to work. Without having
> called gpiochip_irqchip_add() already, this will be NULL:
>
>         if (!chip->to_irq)
>                 return;    <-- It will return here.
>
>         INIT_LIST_HEAD(&acpi_gpio->events);
>
> In the tear down path, acpi_gpiochip_free_interrupts() will find to_irq is
> no longer NULL, then it will walk an uninitialized list.
>
> So, should this be fixed in gpiolib-acpi?

Maybe, maybe in the drivers. I think Mika has a proposed solution...

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux