summaryrefslogtreecommitdiff
path: root/sys/dev/ic/atw.c
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-06-16 00:21:17 +0000
committerriastradh <riastradh@NetBSD.org>2021-06-16 00:21:17 +0000
commitbbdda93be2f0bfefe91466b398fe42700a6ea284 (patch)
treee75e77046575209dbb21f73d0bc44c61ec0ec6c0 /sys/dev/ic/atw.c
parent5a96957fa793651c8e7093a5a4c2fcae87232af2 (diff)
if_attach and if_initialize cannot fail, don't test return value
These were originally made failable back in 2017 when if_initialize allocated a softint in every interface for link state changes, so that it could fail gracefully instead of panicking: https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html However, this spawned many seldom- or never-tested error branches, which are risky to have around. And that softint in every interface has since been replaced by a single global workqueue, because link state changes require thread context but not low latency or high throughput: https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html So there is no longer any reason for if_initialize to fail. (The subroutine if_stats_init can't fail because percpu_alloc can't fail either.) There is a snag: the softint_establish in if_percpuq_create could fail, potentially leading to bad consequences later on trying to use the softint. This change doesn't introduce any new bugs because of the snag -- if_percpuq_attach was already broken. However, the snag can be better addressed without spawning error branches, either by using a single softint or making softints less scarce. (Separate commit will change the signatures of if_attach and if_initialize to return void, scheduled to ride whatever is the next convenient kernel bump.) Patch and testing on amd64 and evbmips64-eb by maya@; commit message soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
Diffstat (limited to 'sys/dev/ic/atw.c')
-rw-r--r--sys/dev/ic/atw.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c
index 4367ee58b9a..c628da6d61f 100644
--- a/sys/dev/ic/atw.c
+++ b/sys/dev/ic/atw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atw.c,v 1.170 2020/01/29 14:09:58 thorpej Exp $ */
+/* $NetBSD: atw.c,v 1.171 2021/06/16 00:21:18 riastradh Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.170 2020/01/29 14:09:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.171 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
@@ -780,12 +780,7 @@ atw_attach(struct atw_softc *sc)
* Call MI attach routines.
*/
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail_5;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
06-10-25Introduce KAUTH_REQ_NETWORK_SOCKET_OPEN, to check if opening a socket iselad 2006-10-20Introduce a new action on the network scope, KAUTH_NETWORK_INTERFACE,elad 2006-10-20Add a new ALTQ kauth(9) request, KAUTH_REQ_NETWORK_ALTQ_JOBS.elad 2006-10-13Introduce KAUTH_REQ_NETWORK_SOCKET_CANSEE. Since we're not gonna be havingelad 2006-09-15Add skeleton files to be used by developers interested in writing NetBSDelad