usbnet: No need for the core lock in usbnet_ifflags_cb.

The only state this touches is unp_if_flags, and all paths touching
it also hold IFNET_LOCK -- not to mention this is the only path that
touches unp_if_flags in the first place!
This commit is contained in:
riastradh 2022-03-03 05:52:27 +00:00
parent 5c872ef115
commit 751cff0160
1 changed files with 2 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbnet.c,v 1.79 2022/03/03 05:52:20 riastradh Exp $ */
/* $NetBSD: usbnet.c,v 1.80 2022/03/03 05:52:27 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.79 2022/03/03 05:52:20 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.80 2022/03/03 05:52:27 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -987,8 +987,6 @@ usbnet_ifflags_cb(struct ethercom *ec)
KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
mutex_enter(&unp->unp_core_lock);
const u_short changed = ifp->if_flags ^ unp->unp_if_flags;
if ((changed & ~(IFF_CANTCHANGE | IFF_DEBUG)) == 0) {
unp->unp_if_flags = ifp->if_flags;
@ -998,8 +996,6 @@ usbnet_ifflags_cb(struct ethercom *ec)
rv = ENETRESET;
}
mutex_exit(&unp->unp_core_lock);
return rv;
}