On Wed, Feb 14, 2024 at 8:31 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > > 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 > This not being GFP_ATOMIC is the least of the problems, we could simply change it back... > 121 if (!new) > 122 return -ENOMEM; > 123 } > 124 > 125 old = rcu_replace_pointer(desc->label, new, 1); > 126 synchronize_srcu(&desc->srcu); ... but this synchronize_srcu() call will trigger the same issue. > 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); > So it should not be calling gpiod_set_consumer_name() but well, technical dept. I'll see if this can be changed. Bart > regards, > dan carpenter >