From 608c7d9407c1fed604feadcda68619eb6b876952 Mon Sep 17 00:00:00 2001 From: bluhm Date: Sun, 7 Jan 2024 21:01:45 +0000 Subject: [PATCH] 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@ --- sys/dev/pci/if_ixl.c | 4 ++-- 1 file 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 | -- 2.20.1