On Wed, Feb 14, 2024 at 09:55:17AM +0100, Bartosz Golaszewski wrote: > 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. Hm... Smatch only triggers a warning for the first sleep. But then Smatch doesn't consider synchronize_srcu() as a sleeping function because of the first return before the might_sleep() so if it did trigger a static checker warning it would be inside the synchronize_srcu() function. And unfortunately I ignore synchronize_srcu() warnings because there are some kind of old bugs which trigger that warning... Sadness all around on that count, I guess. regards, dan carpenter