summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-01-07 21:01:46 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-01-07 21:01:46 +0000
commit24fed8b703b4884fe25f76399877d9d963326a44 (patch)
treed949475adc1aa2d0b670c4d1af4f5b7e4ab7de21
parente4eaf3cc9b768978a46e311724fb00d02681a385 (diff)
In ixl(4) attach, initialize mutex before using it.
Function ixl_get_link_status() calls ixl_set_link_status() which locks sc_link_state_mtx. Move initilization of mutex before calling ixl_get_link_status(). This makes witness happy. Bug reported and fix tested by Hrvoje Popovski; OK miod@
-rw-r--r--sys/dev/pci/if_ixl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/if_ixl.c b/sys/dev/pci/if_ixl.c
index 88e0bb93f24..1f89dd73e87 100644
--- a/sys/dev/pci/if_ixl.c
+++ b/sys/dev/pci/if_ixl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ixl.c,v 1.94 2023/12/30 17:52:27 bluhm Exp $ */
+/* $OpenBSD: if_ixl.c,v 1.95 2024/01/07 21:01:45 bluhm Exp $ */
/*
* Copyright (c) 2013-2015, Intel Corporation
@@ -1881,6 +1881,7 @@ ixl_attach(struct device *parent, struct device *self, void *aux)
goto free_hmc;
}
+ mtx_init(&sc->sc_link_state_mtx, IPL_NET);
if (ixl_get_link_status(sc) != 0) {
/* error printed by ixl_get_link_status */
goto free_hmc;
@@ -1987,7 +1988,6 @@ ixl_attach(struct device *parent, struct device *self, void *aux)
if_attach_queues(ifp, nqueues);
if_attach_iqueues(ifp, nqueues);
- mtx_init(&sc->sc_link_state_mtx, IPL_NET);
task_set(&sc->sc_link_state_task, ixl_link_state_update, sc);
ixl_wr(sc, I40E_PFINT_ICR0_ENA,
I40E_PFINT_ICR0_ENA_LINK_STAT_CHANGE_MASK |