[bug report] gpio: remove gpio_lock

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

 



Hello Bartosz Golaszewski,

The patch 35b545332b80: "gpio: remove gpio_lock" from Jan 12, 2024
(linux-next), leads to the following Smatch static checker warning:

	drivers/gpio/gpiolib.c:120 desc_set_label()
	warn: sleeping in atomic context

drivers/gpio/gpiolib.c
    115 static int desc_set_label(struct gpio_desc *desc, const char *label)
    116 {
    117         const char *new = NULL, *old;
    118 
    119         if (label) {
--> 120                 new = kstrdup_const(label, GFP_KERNEL);
                                                   ^^^^^^^^^^
This used to be GFP_ATOMIC

    121                 if (!new)
    122                         return -ENOMEM;
    123         }
    124 
    125         old = rcu_replace_pointer(desc->label, new, 1);
    126         synchronize_srcu(&desc->srcu);
    127         kfree_const(old);
    128 
    129         return 0;
    130 }

The call tree that triggers the warning is:

asc_set_termios() <- disables preempt
-> gpiod_set_consumer_name()
   -> desc_set_label()

asc_set_termios() is holding uart_port_lock_irqsave(port, &flags);

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