[bug report] gpiolib: remove gpiochip_is_requested()

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

 



Hello Bartosz Golaszewski,

The patch f8d05e276b45: "gpiolib: remove gpiochip_is_requested()"
from Dec 4, 2023 (linux-next), leads to the following Smatch static
checker warning:

	drivers/gpio/gpiolib.c:2402 gpiochip_dup_line_label()
	warn: sleeping in atomic context

drivers/gpio/gpiolib.c
    2392 
    2393         desc = gpiochip_get_desc(gc, offset);
    2394         if (IS_ERR(desc))
    2395                 return NULL;
    2396 
    2397         guard(spinlock_irqsave)(&gpio_lock);
                       ^^^^^^^^^^^^^^^^
This takes the lock until the end of scope (the end of the function in
this case).


    2398 
    2399         if (!test_bit(FLAG_REQUESTED, &desc->flags))
    2400                 return NULL;
    2401 
--> 2402         label = kstrdup(desc->label, GFP_KERNEL);
                                              ^^^^^^^^^^
Can't do GFP_KERNEL allocations while holding a spinlock.  Testing with
CONFIG_DEBUG_ATOMIC_SLEEP will warn about this.

    2403         if (!label)
    2404                 return ERR_PTR(-ENOMEM);
    2405 
    2406         return label;
    2407 }

regards,
dan carpenter




[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