Re: [bug report] tty: st-asc: switch to using devm_gpiod_get()

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

 



Hi Dan,

On Wed, Oct 26, 2022 at 05:05:16PM +0300, Dan Carpenter wrote:
> Hello Dmitry Torokhov,
> 
> The patch 8c44f9b566a3: "tty: st-asc: switch to using
> devm_gpiod_get()" from Jan 4, 2020, leads to the following Smatch
> static checker warning:
> 
> 	drivers/gpio/gpiolib-devres.c:118 devm_gpiod_get_index()
> 	warn: sleeping in atomic context

You already reported this one:

https://lore.kernel.org/all/20210813124155.GA7367@kili/

As I mentioned back then my change simply swapped one devm invocation
for another, with the problem of sleeping in an atomic context being
already present. In fact the issue was introduced in:

commit d7356256488c544b8fdc2c3a775ce069546d7933
Author: Lee Jones <lee.jones@xxxxxxxxxx>
Date:   Fri Feb 3 10:23:13 2017 +0000

    serial: st-asc: (De)Register GPIOD and swap Pinctrl profiles

    When hardware flow-control is disabled, manual toggling of the UART's
    reset line (RTS) using userland applications (e.g. stty) is not
    possible, since the ASC IP does not provide this functionality in the
    same was as some other IPs do.  Thus, we have to do this manually.

    This patch ensures that when HW flow-control is disabled the RTS/CTS
    lines are free to be registered via the GPIO API.  It also ensures
    any registered GPIO lines are unregistered when HW flow-control is
    requested, allowing the IP to control them automatically.

    Acked-by: Peter Griffin <peter.griffin@xxxxxxxxxx>
    Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

and I mentioned that Lee and Greg should look into fixing it. In
general, doing gpio allocation, or pin control switching while holding a
lock and/or with interrupts disabled is problematic...

Thanks.

-- 
Dmitry



[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