* [bug report] net: lan966x: add support for interrupts from analyzer
@ 2022-01-19 10:40 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-01-19 10:40 UTC (permalink / raw)
To: horatiu.vultur; +Cc: kernel-janitors
Hello Horatiu Vultur,
The patch 5ccd66e01cbe: "net: lan966x: add support for interrupts
from analyzer" from Dec 18, 2021, leads to the following Smatch
static checker warning:
drivers/net/ethernet/microchip/lan966x/lan966x_mac.c:43 lan966x_mac_wait_for_completion()
warn: sleeping in atomic context
The call tree is:
lan966x_mac_del_entry() <- disables preempt
lan966x_mac_purge_entries() <- disables preempt
-> lan966x_mac_forget()
-> lan966x_mac_wait_for_completion()
drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
261 int lan966x_mac_del_entry(struct lan966x *lan966x, const unsigned char *addr,
262 u16 vid)
263 {
264 struct lan966x_mac_entry *mac_entry, *tmp;
265
266 spin_lock(&lan966x->mac_lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Take a spin locks
267 list_for_each_entry_safe(mac_entry, tmp, &lan966x->mac_entries,
268 list) {
269 if (mac_entry->vid == vid &&
270 ether_addr_equal(addr, mac_entry->mac)) {
271 lan966x_mac_forget(lan966x, mac_entry->mac, mac_entry->vid,
^^^^^^^^^^^^^^^^^^
Calls function which can sleep
272 ENTRYTYPE_LOCKED);
273
274 list_del(&mac_entry->list);
275 kfree(mac_entry);
276 }
277 }
278 spin_unlock(&lan966x->mac_lock);
279
280 return 0;
281 }
282
283 void lan966x_mac_purge_entries(struct lan966x *lan966x)
284 {
285 struct lan966x_mac_entry *mac_entry, *tmp;
286
287 spin_lock(&lan966x->mac_lock);
288 list_for_each_entry_safe(mac_entry, tmp, &lan966x->mac_entries,
289 list) {
290 lan966x_mac_forget(lan966x, mac_entry->mac, mac_entry->vid,
Same thing
291 ENTRYTYPE_LOCKED);
292
293 list_del(&mac_entry->list);
294 kfree(mac_entry);
295 }
296 spin_unlock(&lan966x->mac_lock);
297 }
drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
39 static int lan966x_mac_wait_for_completion(struct lan966x *lan966x)
40 {
41 u32 val;
42
--> 43 return readx_poll_timeout(lan966x_mac_get_status,
^^^^^^^^^^^^^^^^^^
sleeps
44 lan966x, val,
45 (ANA_MACACCESS_MAC_TABLE_CMD_GET(val)) ==
46 MACACCESS_CMD_IDLE,
47 TABLE_UPDATE_SLEEP_US, TABLE_UPDATE_TIMEOUT_US);
48 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-19 10:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-19 10:40 [bug report] net: lan966x: add support for interrupts from analyzer Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).