summaryrefslogtreecommitdiff
path: root/sys/dev
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
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')
-rw-r--r--sys/dev/hyperv/if_hvn.c11
-rw-r--r--sys/dev/ic/an.c10
-rw-r--r--sys/dev/ic/athn.c15
-rw-r--r--sys/dev/ic/atw.c11
-rw-r--r--sys/dev/ic/bwfm.c12
-rw-r--r--sys/dev/ic/bwi.c11
-rw-r--r--sys/dev/ic/dwc_gmac.c15
-rw-r--r--sys/dev/ic/malo.c17
-rw-r--r--sys/dev/ic/rt2560.c12
-rw-r--r--sys/dev/ic/rt2661.c12
-rw-r--r--sys/dev/ic/rt2860.c24
-rw-r--r--sys/dev/ic/rtw.c10
-rw-r--r--sys/dev/ic/wi.c15
-rw-r--r--sys/dev/pci/if_aq.c11
-rw-r--r--sys/dev/pci/if_iavf.c10
-rw-r--r--sys/dev/pci/if_ipw.c12
-rw-r--r--sys/dev/pci/if_iwi.c12
-rw-r--r--sys/dev/pci/if_iwm.c12
-rw-r--r--sys/dev/pci/if_iwn.c12
-rw-r--r--sys/dev/pci/if_ixl.c10
-rw-r--r--sys/dev/pci/if_rtwn.c17
-rw-r--r--sys/dev/pci/if_wm.c11
-rw-r--r--sys/dev/pci/if_wpi.c12
-rw-r--r--sys/dev/pci/ixgbe/ixgbe.c11
-rw-r--r--sys/dev/pci/ixgbe/ixv.c11
-rw-r--r--sys/dev/pcmcia/if_malo_pcmcia.c21
-rw-r--r--sys/dev/scsipi/if_se.c10
-rw-r--r--sys/dev/usb/if_umb.c12
-rw-r--r--sys/dev/usb/usbnet.c10
29 files changed, 91 insertions, 278 deletions
diff --git a/sys/dev/hyperv/if_hvn.c b/sys/dev/hyperv/if_hvn.c
index aa1aa499738..41f8495c4e7 100644
--- a/sys/dev/hyperv/if_hvn.c
+++ b/sys/dev/hyperv/if_hvn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_hvn.c,v 1.20 2021/01/29 04:38:49 nonaka Exp $ */
+/* $NetBSD: if_hvn.c,v 1.21 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $ */
/*-
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.20 2021/01/29 04:38:49 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.21 2021/06/16 00:21:18 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -243,7 +243,6 @@ hvn_attach(device_t parent, device_t self, void *aux)
struct vmbus_attach_args *aa = aux;
struct ifnet *ifp = SC2IFP(sc);
uint8_t enaddr[ETHER_ADDR_LEN];
- int error;
sc->sc_dev = self;
sc->sc_vmbus = (struct vmbus_softc *)device_private(parent);
@@ -302,11 +301,7 @@ hvn_attach(device_t parent, device_t self, void *aux)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL);
- error = if_initialize(ifp);
- if (error) {
- aprint_error_dev(self, "if_initialize failed(%d)\n", error);
- goto fail3;
- }
+ if_initialize(ifp);
sc->sc_ipq = if_percpuq_create(ifp);
if_deferred_start_init(ifp, NULL);
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c
index 939e2915e54..4804ffca48c 100644
--- a/sys/dev/ic/an.c
+++ b/sys/dev/ic/an.c
@@ -1,4 +1,4 @@
-/* $NetBSD: an.c,v 1.74 2021/06/11 05:00:41 jdc Exp $ */
+/* $NetBSD: an.c,v 1.75 2021/06/16 00:21:18 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.74 2021/06/11 05:00:41 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.75 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
@@ -315,11 +315,7 @@ an_attach(struct an_softc *sc)
/*
* Call MI attach routine.
*/
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n", rv);
- goto fail_2;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
ifp->if_percpuq = if_percpuq_create(ifp);
if_register(ifp);
diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c
index b6163dcf5a4..0a5779938c7 100644
--- a/sys/dev/ic/athn.c
+++ b/sys/dev/ic/athn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: athn.c,v 1.24 2020/11/15 12:33:53 mlelstv Exp $ */
+/* $NetBSD: athn.c,v 1.25 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: athn.c,v 1.83 2014/07/22 13:12:11 mpi Exp $ */
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.24 2020/11/15 12:33:53 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.25 2021/06/16 00:21:18 riastradh Exp $");
#ifndef _MODULE
#include "athn_usb.h" /* for NATHN_USB */
@@ -348,16 +348,7 @@ athn_attach(struct athn_softc *sc)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- pmf_event_deregister(sc->sc_dev, PMFE_RADIO_OFF,
- athn_pmf_wlan_off, false);
- callout_destroy(&sc->sc_scan_to);
- callout_destroy(&sc->sc_calib_to);
- return error;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
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);
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c
index 89c1b08aefa..b42abf3004c 100644
--- a/sys/dev/ic/bwfm.c
+++ b/sys/dev/ic/bwfm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.30 2021/04/13 04:13:52 mrg Exp $ */
+/* $NetBSD: bwfm.c,v 1.31 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -422,15 +422,7 @@ bwfm_attach(struct bwfm_softc *sc)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ);
- error = if_initialize(ifp);
- if (error != 0) {
- printf("%s: if_initialize failed(%d)\n", DEVNAME(sc), error);
- pool_cache_destroy(sc->sc_freetask);
- workqueue_destroy(sc->sc_taskq);
-
- return; /* Error */
- }
-
+ if_initialize(ifp);
ieee80211_ifattach(ic);
sc->sc_newstate = ic->ic_newstate;
ic->ic_newstate = bwfm_newstate;
diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c
index 32c819de01c..4483d23043c 100644
--- a/sys/dev/ic/bwi.c
+++ b/sys/dev/ic/bwi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bwi.c,v 1.37 2020/01/29 14:14:55 thorpej Exp $ */
+/* $NetBSD: bwi.c,v 1.38 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $ */
/*
@@ -48,7 +48,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.37 2020/01/29 14:14:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.38 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
#include <sys/callout.h>
@@ -1021,12 +1021,7 @@ bwi_attach(struct bwi_softc *sc)
ic->ic_updateslot = bwi_updateslot;
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
ifp->if_percpuq = if_percpuq_create(ifp);
if_register(ifp);
diff --git a/sys/dev/ic/dwc_gmac.c b/sys/dev/ic/dwc_gmac.c
index e12d86a8ffa..1d2a7fa50a0 100644
--- a/sys/dev/ic/dwc_gmac.c
+++ b/sys/dev/ic/dwc_gmac.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.73 2021/05/13 05:56:39 msaitoh Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.74 2021/06/16 00:21:18 riastradh Exp $ */
/*-
* Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.73 2021/05/13 05:56:39 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.74 2021/06/16 00:21:18 riastradh Exp $");
/* #define DWC_GMAC_DEBUG 1 */
@@ -188,7 +188,6 @@ dwc_gmac_attach(struct dwc_gmac_softc *sc, int phy_id, uint32_t mii_clk)
struct mii_data * const mii = &sc->sc_mii;
struct ifnet * const ifp = &sc->sc_ec.ec_if;
prop_dictionary_t dict;
- int rv;
mutex_init(&sc->sc_mdio_lock, MUTEX_DEFAULT, IPL_NET);
sc->sc_mii_clk = mii_clk & 7;
@@ -332,9 +331,7 @@ dwc_gmac_attach(struct dwc_gmac_softc *sc, int phy_id, uint32_t mii_clk)
* Ready, attach interface
*/
/* Attach the interface. */
- rv = if_initialize(ifp);
- if (rv != 0)
- goto fail_2;
+ if_initialize(ifp);
sc->sc_ipq = if_percpuq_create(&sc->sc_ec.ec_if);
if_deferred_start_init(ifp, NULL);
ether_ifattach(ifp, enaddr);
@@ -355,12 +352,6 @@ dwc_gmac_attach(struct dwc_gmac_softc *sc, int phy_id, uint32_t mii_clk)
return 0;
-fail_2:
- ifmedia_removeall(&mii->mii_media);
- mii_detach(mii, MII_PHY_ANY, MII_OFFSET_ANY);
- mutex_destroy(&sc->sc_txq.t_mtx);
- mutex_destroy(&sc->sc_rxq.r_mtx);
- mutex_obj_free(sc->sc_lock);
fail:
dwc_gmac_free_rx_ring(sc, &sc->sc_rxq);
dwc_gmac_free_tx_ring(sc, &sc->sc_txq);
diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c
index 535645dddcf..07aba8cd77d 100644
--- a/sys/dev/ic/malo.c
+++ b/sys/dev/ic/malo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: malo.c,v 1.18 2020/01/29 15:00:39 thorpej Exp $ */
+/* $NetBSD: malo.c,v 1.19 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */
/*
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.18 2020/01/29 15:00:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.19 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -366,7 +366,7 @@ malo_attach(struct malo_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ifnet *ifp = &sc->sc_if;
- int i, rv;
+ int i;
/* initialize channel scanning timer */
callout_init(&sc->sc_scan_to, 0);
@@ -422,16 +422,7 @@ malo_attach(struct malo_softc *sc)
aprint_normal(", address %s\n", ether_sprintf(ic->ic_myaddr));
/* attach interface */
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n", rv);
- malo_free_tx_ring(sc, &sc->sc_txring);
- malo_free_rx_ring(sc, &sc->sc_rxring);
- malo_free_cmd(sc);
- callout_destroy(&sc->sc_scan_to);
-
- return rv; /* Error */
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c
index 7d21b6b820c..b32f6de6f8e 100644
--- a/sys/dev/ic/rt2560.c
+++ b/sys/dev/ic/rt2560.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2560.c,v 1.38 2020/01/29 15:06:12 thorpej Exp $ */
+/* $NetBSD: rt2560.c,v 1.39 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $ */
/* $FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/
@@ -24,7 +24,7 @@
* http://www.ralinktech.com/
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.38 2020/01/29 15:06:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.39 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
@@ -441,12 +441,7 @@ rt2560_attach(void *xsc, int id)
IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
}
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail6;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -485,7 +480,6 @@ rt2560_attach(void *xsc, int id)
return 0;
-fail6: rt2560_free_rx_ring(sc, &sc->rxq);
fail5: rt2560_free_tx_ring(sc, &sc->bcnq);
fail4: rt2560_free_tx_ring(sc, &sc->prioq);
fail3: rt2560_free_tx_ring(sc, &sc->atimq);
diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c
index 8be915d72f5..3bdeed88e45 100644
--- a/sys/dev/ic/rt2661.c
+++ b/sys/dev/ic/rt2661.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2661.c,v 1.43 2020/01/29 15:06:12 thorpej Exp $ */
+/* $NetBSD: rt2661.c,v 1.44 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */
/* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.43 2020/01/29 15:06:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.44 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
@@ -330,12 +330,7 @@ rt2661_attach(void *xsc, int id)
IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
}
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail7;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -373,7 +368,6 @@ rt2661_attach(void *xsc, int id)
return 0;
-fail7: rt2661_free_rx_ring(sc, &sc->rxq);
fail6: rt2661_free_tx_ring(sc, &sc->mgtq);
fail5: rt2661_free_tx_ring(sc, &sc->txq[3]);
fail4: rt2661_free_tx_ring(sc, &sc->txq[2]);
diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c
index d4b9dd6271c..0238b02bad0 100644
--- a/sys/dev/ic/rt2860.c
+++ b/sys/dev/ic/rt2860.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2860.c,v 1.35 2020/01/29 15:06:12 thorpej Exp $ */
+/* $NetBSD: rt2860.c,v 1.36 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */
/* $FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.35 2020/01/29 15:06:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.36 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
#include <sys/sockio.h>
@@ -401,25 +401,7 @@ rt2860_attachhook(device_t self)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
- error = if_initialize(ifp);
- if (error != 0) {
- int qid;
-
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- for (qid = 0; qid < MAXQS; qid++)
- rt2860_free_tx_ring(sc, &sc->txq[qid]);
- rt2860_free_rx_ring(sc, &sc->rxq);
- rt2860_free_tx_pool(sc);
-
- if (sc->sc_soft_ih != NULL) {
- softint_disestablish(sc->sc_soft_ih);
- sc->sc_soft_ih = NULL;
- }
- if (sc->ucode != NULL)
- firmware_free(sc->ucode, sc->ucsize);
- return;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c
index d88f3f070c0..6249e566e6a 100644
--- a/sys/dev/ic/rtw.c
+++ b/sys/dev/ic/rtw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtw.c,v 1.135 2020/01/29 15:06:12 thorpej Exp $ */
+/* $NetBSD: rtw.c,v 1.136 2021/06/16 00:21:18 riastradh Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights
* reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.135 2020/01/29 15:06:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.136 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
@@ -4224,11 +4224,7 @@ rtw_attach(struct rtw_softc *sc)
/*
* Call MI attach routines.
*/
- rc = if_initialize(ifp);
- if (rc != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n", rc);
- goto err;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
diff --git a/sys/dev/ic/wi.c b/sys/dev/ic/wi.c
index 787fcc481a9..602ce27ce55 100644
--- a/sys/dev/ic/wi.c
+++ b/sys/dev/ic/wi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wi.c,v 1.255 2020/01/30 04:56:11 thorpej Exp $ */
+/* $NetBSD: wi.c,v 1.256 2021/06/16 00:21:18 riastradh Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.255 2020/01/30 04:56:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.256 2021/06/16 00:21:18 riastradh Exp $");
#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
@@ -370,7 +370,7 @@ wi_attach(struct wi_softc *sc, const uint8_t *macaddr)
static const uint8_t empty_macaddr[IEEE80211_ADDR_LEN] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- int s, rv;
+ int s;
sc->sc_soft_ih = softint_establish(SOFTINT_NET, wi_softintr, sc);
if (sc->sc_soft_ih == NULL) {
@@ -546,11 +546,7 @@ wi_attach(struct wi_softc *sc, const uint8_t *macaddr)
/*
* Call MI attach routines.
*/
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n", rv);
- goto fail_2;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -588,9 +584,6 @@ wi_attach(struct wi_softc *sc, const uint8_t *macaddr)
ieee80211_announce(ic);
return 0;
-fail_2:
- callout_destroy(&sc->sc_rssadapt_ch);
-
fail: splx(s);
softint_disestablish(sc->sc_soft_ih);
sc->sc_soft_ih = NULL;
diff --git a/sys/dev/pci/if_aq.c b/sys/dev/pci/if_aq.c
index c1239572e63..eaafda9d899 100644
--- a/sys/dev/pci/if_aq.c
+++ b/sys/dev/pci/if_aq.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aq.c,v 1.26 2021/06/13 10:05:39 mlelstv Exp $ */
+/* $NetBSD: if_aq.c,v 1.27 2021/06/16 00:21:18 riastradh Exp $ */
/**
* aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.26 2021/06/13 10:05:39 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.27 2021/06/16 00:21:18 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_if_aq.h"
@@ -1458,12 +1458,7 @@ aq_attach(device_t parent, device_t self, void *aux)
ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv6_Rx;
ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv6_Rx;
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto attach_failure;
- }
+ if_initialize(ifp);
ifp->if_percpuq = if_percpuq_create(ifp);
if_deferred_start_init(ifp, NULL);
ether_ifattach(ifp, sc->sc_enaddr.ether_addr_octet);
diff --git a/sys/dev/pci/if_iavf.c b/sys/dev/pci/if_iavf.c
index 87dfcc797ae..25cec2079f2 100644
--- a/sys/dev/pci/if_iavf.c
+++ b/sys/dev/pci/if_iavf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iavf.c,v 1.13 2021/03/05 13:21:07 yamaguchi Exp $ */
+/* $NetBSD: if_iavf.c,v 1.14 2021/06/16 00:21:18 riastradh Exp $ */
/*
* Copyright (c) 2013-2015, Intel Corporation
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.13 2021/03/05 13:21:07 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.14 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -876,11 +876,7 @@ iavf_attach(device_t parent, device_t self, void *aux)
goto teardown_wqs;
}
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(self, "if_initialize failed=%d\n", error);
- goto teardown_wqs;
- }
+ if_initialize(ifp);
strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c
index ac42ef2cf7e..d0269fd2bba 100644
--- a/sys/dev/pci/if_ipw.c
+++ b/sys/dev/pci/if_ipw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ipw.c,v 1.73 2020/01/30 06:03:34 thorpej Exp $ */
+/* $NetBSD: if_ipw.c,v 1.74 2021/06/16 00:21:18 riastradh Exp $ */
/* FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp */
/*-
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.73 2020/01/30 06:03:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.74 2021/06/16 00:21:18 riastradh Exp $");
/*-
* Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -298,13 +298,7 @@ ipw_attach(device_t parent, device_t self, void *aux)
aprint_normal_dev(sc->sc_dev, "802.11 address %s\n",
ether_sprintf(ic->ic_myaddr));
- error = if_initialize(ifp);
- if (error != 0) {
- ifp->if_softc = NULL; /* For ipw_detach(). */
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c
index 1d9ebe55696..b8281f851e8 100644
--- a/sys/dev/pci/if_iwi.c
+++ b/sys/dev/pci/if_iwi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwi.c,v 1.115 2021/05/08 00:27:02 thorpej Exp $ */
+/* $NetBSD: if_iwi.c,v 1.116 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */
/*-
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.115 2021/05/08 00:27:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.116 2021/06/16 00:21:18 riastradh Exp $");
/*-
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -364,13 +364,7 @@ iwi_attach(device_t parent, device_t self, void *aux)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
- error = if_initialize(ifp);
- if (error != 0) {
- ifp->if_softc = NULL; /* For iwi_detach() */
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 3f83d277737..3139ced7a0e 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwm.c,v 1.85 2020/05/22 20:27:16 thorpej Exp $ */
+/* $NetBSD: if_iwm.c,v 1.86 2021/06/16 00:21:18 riastradh Exp $ */
/* OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp */
#define IEEE80211_NO_HT
/*
@@ -106,7 +106,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.85 2020/05/22 20:27:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.86 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -8136,12 +8136,7 @@ iwm_attach(device_t parent, device_t self, void *aux)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ);
- err = if_initialize(ifp);
- if (err != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- err);
- goto fail6;
- }
+ if_initialize(ifp);
#if 0
ieee80211_ifattach(ic);
#else
@@ -8193,7 +8188,6 @@ iwm_attach(device_t parent, device_t self, void *aux)
return;
-fail6: iwm_free_rx_ring(sc, &sc->rxq);
fail5: while (--txq_i >= 0)
iwm_free_tx_ring(sc, &sc->txq[txq_i]);
fail4: iwm_dma_contig_free(&sc->sched_dma);
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 6256c901f40..cdd3bf3ee77 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwn.c,v 1.95 2021/05/08 00:27:02 thorpej Exp $ */
+/* $NetBSD: if_iwn.c,v 1.96 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $ */
/*-
@@ -22,7 +22,7 @@
* adapters.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.95 2021/05/08 00:27:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.96 2021/06/16 00:21:18 riastradh Exp $");
#define IWN_USE_RBUF /* Use local storage for RX */
#undef IWN_HWCRYPTO /* XXX does not even compile yet */
@@ -659,12 +659,7 @@ iwn_attach(device_t parent __unused, device_t self, void *aux)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail5;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -715,7 +710,6 @@ iwn_attach(device_t parent __unused, device_t self, void *aux)
return;
/* Free allocated memory if something failed during attachment. */
-fail5: iwn_free_rx_ring(sc, &sc->rxq);
fail4: while (--i >= 0)
iwn_free_tx_ring(sc, &sc->txq[i]);
#ifdef IWN_USE_RBUF
diff --git a/sys/dev/pci/if_ixl.c b/sys/dev/pci/if_ixl.c
index 257a894b5cd..c1d51fd4e32 100644
--- a/sys/dev/pci/if_ixl.c
+++ b/sys/dev/pci/if_ixl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ixl.c,v 1.76 2021/02/09 15:05:49 jakllsch Exp $ */
+/* $NetBSD: if_ixl.c,v 1.77 2021/06/16 00:21:18 riastradh Exp $ */
/*
* Copyright (c) 2013-2015, Intel Corporation
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.76 2021/02/09 15:05:49 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.77 2021/06/16 00:21:18 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -1316,11 +1316,7 @@ ixl_attach(device_t parent, device_t self, void *aux)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_NONE, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(self, "if_initialize failed=%d\n", rv);
- goto teardown_wqs;
- }
+ if_initialize(ifp);
sc->sc_ipq = if_percpuq_create(ifp);
if_deferred_start_init(ifp, NULL);
diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c
index 3f6a26a86c8..14c8412dee0 100644
--- a/sys/dev/pci/if_rtwn.c
+++ b/sys/dev/pci/if_rtwn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtwn.c,v 1.19 2020/01/30 06:03:34 thorpej Exp $ */
+/* $NetBSD: if_rtwn.c,v 1.20 2021/06/16 00:21:18 riastradh Exp $ */
/* $OpenBSD: if_rtwn.c,v 1.5 2015/06/14 08:02:47 stsp Exp $ */
#define IEEE80211_NO_HT
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.19 2020/01/30 06:03:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.20 2021/06/16 00:21:18 riastradh Exp $");
#include <sys/param.h>
#include <sys/sockio.h>
@@ -359,13 +359,7 @@ rtwn_attach(device_t parent, device_t self, void *aux)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
- error = if_initialize(ifp);
- if (error != 0) {
- ifp->if_softc = NULL; /* For rtwn_detach() */
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -397,11 +391,6 @@ rtwn_attach(device_t parent, device_t self, void *aux)
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
-
- return;
-
-fail:
- rtwn_detach(self, 0);
}
static int
diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c
index 0e6a121927b..8b30ddc8b3b 100644
--- a/sys/dev/pci/if_wm.c
+++ b/sys/dev/pci/if_wm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.704 2021/05/12 10:16:12 knakahara Exp $ */
+/* $NetBSD: if_wm.c,v 1.705 2021/06/16 00:21:18 riastradh Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.704 2021/05/12 10:16:12 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.705 2021/06/16 00:21:18 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -3091,12 +3091,7 @@ alloc_retry:
sc->sc_rx_intr_process_limit = WM_RX_INTR_PROCESS_LIMIT_DEFAULT;
/* Attach the interface. */
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- return; /* Error */
- }
+ if_initialize(ifp);
sc->sc_ipq = if_percpuq_create(&sc->sc_ethercom.ec_if);
ether_ifattach(ifp, enaddr);
ether_set_ifflags_cb(&sc->sc_ethercom, wm_ifflags_cb);
diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c
index d3217400a47..29c0d3aed98 100644
--- a/sys/dev/pci/if_wpi.c
+++ b/sys/dev/pci/if_wpi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wpi.c,v 1.90 2021/02/05 16:06:24 christos Exp $ */
+/* $NetBSD: if_wpi.c,v 1.91 2021/06/16 00:21:18 riastradh Exp $ */
/*-
* Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.90 2021/02/05 16:06:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.91 2021/06/16 00:21:18 riastradh Exp $");
/*
* Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -370,12 +370,7 @@ wpi_attach(device_t parent __unused, device_t self, void *aux)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
- error);
- goto fail5;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -422,7 +417,6 @@ wpi_attach(device_t parent __unused, device_t self, void *aux)
return;
/* free allocated memory if something failed during attachment */
-fail5: wpi_free_rx_ring(sc, &sc->rxq);
fail4: wpi_free_tx_ring(sc, &sc->cmdq);
fail3: while (--ac >= 0)
wpi_free_tx_ring(sc, &sc->txq[ac]);
diff --git a/sys/dev/pci/ixgbe/ixgbe.c b/sys/dev/pci/ixgbe/ixgbe.c
index f198b853392..bb823f05eeb 100644
--- a/sys/dev/pci/ixgbe/ixgbe.c
+++ b/sys/dev/pci/ixgbe/ixgbe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.283 2021/05/18 05:29:16 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.284 2021/06/16 00:21:18 riastradh Exp $ */
/******************************************************************************
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.283 2021/05/18 05:29:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.284 2021/06/16 00:21:18 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1335,7 +1335,6 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter)
{
struct ethercom *ec = &adapter->osdep.ec;
struct ifnet *ifp;
- int rv;
INIT_DEBUGOUT("ixgbe_setup_interface: begin");
@@ -1370,11 +1369,7 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter)
IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 2);
IFQ_SET_READY(&ifp->if_snd);
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(dev, "if_initialize failed(%d)\n", rv);
- return rv;
- }
+ if_initialize(ifp);
adapter->ipq = if_percpuq_create(&adapter->osdep.ec.ec_if);
ether_ifattach(ifp, adapter->hw.mac.addr);
aprint_normal_dev(dev, "Ethernet address %s\n",
diff --git a/sys/dev/pci/ixgbe/ixv.c b/sys/dev/pci/ixgbe/ixv.c
index 6b4e068326f..4a6b42df1b7 100644
--- a/sys/dev/pci/ixgbe/ixv.c
+++ b/sys/dev/pci/ixgbe/ixv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.161 2021/05/19 08:19:20 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.162 2021/06/16 00:21:18 riastradh Exp $ */
/******************************************************************************
@@ -35,7 +35,7 @@
/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.161 2021/05/19 08:19:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.162 2021/06/16 00:21:18 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1620,7 +1620,6 @@ ixv_setup_interface(device_t dev, struct adapter *adapter)
{
struct ethercom *ec = &adapter->osdep.ec;
struct ifnet *ifp;
- int rv;
INIT_DEBUGOUT("ixv_setup_interface: begin");
@@ -1649,11 +1648,7 @@ ixv_setup_interface(device_t dev, struct adapter *adapter)
IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 2);
IFQ_SET_READY(&ifp->if_snd);
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(dev, "if_initialize failed(%d)\n", rv);
- return rv;
- }
+ if_initialize(ifp);
adapter->ipq = if_percpuq_create(&adapter->osdep.ec.ec_if);
ether_ifattach(ifp, adapter->hw.mac.addr);
aprint_normal_dev(dev, "Ethernet address %s\n",
diff --git a/sys/dev/pcmcia/if_malo_pcmcia.c b/sys/dev/pcmcia/if_malo_pcmcia.c
index d79fab78297..872cf4b05b5 100644
--- a/sys/dev/pcmcia/if_malo_pcmcia.c
+++ b/sys/dev/pcmcia/if_malo_pcmcia.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_malo_pcmcia.c,v 1.25 2020/01/29 13:54:41 thorpej Exp $ */
+/* $NetBSD: if_malo_pcmcia.c,v 1.26 2021/06/16 00:21:19 riastradh Exp $ */
/* $OpenBSD: if_malo.c,v 1.65 2009/03/29 21:53:53 sthen Exp $ */
/*
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.25 2020/01/29 13:54:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.26 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _MODULE
#include <sys/module.h>
@@ -307,7 +307,7 @@ cmalo_attach(void *arg)
struct malo_softc *sc = arg;
struct ieee80211com *ic = &sc->sc_ic;
struct ifnet *ifp = &sc->sc_if;
- int i, rv;
+ int i;
/* disable interrupts */
cmalo_intr_mask(sc, 0);
@@ -318,7 +318,7 @@ cmalo_attach(void *arg)
cmalo_fw_load_main(sc) != 0) {
/* free firmware */
cmalo_fw_free(sc);
- goto fail_1;
+ goto fail;
}
sc->sc_flags |= MALO_FW_LOADED;
@@ -368,11 +368,7 @@ cmalo_attach(void *arg)
}
/* attach interface */
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n", rv);
- goto fail_2;
- }
+ if_initialize(ifp);
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -393,12 +389,7 @@ cmalo_attach(void *arg)
return;
-fail_2:
- cv_destroy(&sc->sc_cv);
- mutex_destroy(&sc->sc_mtx);
- free(sc->sc_cmd, M_DEVBUF);
- free(sc->sc_data, M_DEVBUF);
-fail_1:
+fail:
cmalo_fw_free(sc);
}
diff --git a/sys/dev/scsipi/if_se.c b/sys/dev/scsipi/if_se.c
index ac6940a7cfd..beb21a83fad 100644
--- a/sys/dev/scsipi/if_se.c
+++ b/sys/dev/scsipi/if_se.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_se.c,v 1.112 2020/09/29 02:58:52 msaitoh Exp $ */
+/* $NetBSD: if_se.c,v 1.113 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 1997 Ian W. Dall <ian.dall@dsto.defence.gov.au>
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.112 2020/09/29 02:58:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.113 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -368,11 +368,7 @@ seattach(device_t parent, device_t self, void *aux)
sc->sc_attach_state = 1;
/* Attach the interface. */
- rv = if_initialize(ifp);
- if (rv != 0) {
- sedetach(sc->sc_dev, 0);
- return; /* Error */
- }
+ if_initialize(ifp);
snprintf(wqname, sizeof(wqname), "%sRx", device_xname(sc->sc_dev));
rv = workqueue_create(&sc->sc_recv_wq, wqname, se_recv_worker, sc,
diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c
index 30b0f585d05..1aead36ba7e 100644
--- a/sys/dev/usb/if_umb.c
+++ b/sys/dev/usb/if_umb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_umb.c,v 1.19 2020/03/24 07:12:16 maxv Exp $ */
+/* $NetBSD: if_umb.c,v 1.20 2021/06/16 00:21:19 riastradh Exp $ */
/* $OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
/*
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.19 2020/03/24 07:12:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.20 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -311,7 +311,6 @@ umb_attach(device_t parent, device_t self, void *aux)
int altnum;
int s;
struct ifnet *ifp;
- int rv;
sc->sc_dev = self;
sc->sc_udev = uiaa->uiaa_device;
@@ -532,12 +531,7 @@ umb_attach(device_t parent, device_t self, void *aux)
IFQ_SET_READY(&ifp->if_snd);
/* attach the interface */
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(self, "if_initialize failed(%d)\n", rv);
- splx(s);
- return;
- }
+ if_initialize(ifp);
if_register(ifp);
if_alloc_sadl(ifp);
diff --git a/sys/dev/usb/usbnet.c b/sys/dev/usb/usbnet.c
index febe25118db..3a825d3deb1 100644
--- a/sys/dev/usb/usbnet.c
+++ b/sys/dev/usb/usbnet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.41 2021/04/25 05:15:20 rin Exp $ */
+/* $NetBSD: usbnet.c,v 1.42 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.41 2021/04/25 05:15:20 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.42 2021/06/16 00:21:19 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -1452,11 +1452,7 @@ usbnet_attach_ifp(struct usbnet *un,
unp->unp_link = true;
/* Attach the interface. */
- int rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error_dev(un->un_dev, "if_initialize failed: %d\n", rv);
- return;
- }
+ if_initialize(ifp);
if (ifp->_if_input == NULL)
ifp->if_percpuq = if_percpuq_create(ifp);
if_register(ifp);