usbnet drivers: Prune dead IFF_RUNNING branches in *_uno_init.

usbnet(9) guarantees !IFF_RUNNING now before calling it.
This commit is contained in:
riastradh 2022-03-03 05:55:19 +00:00
parent 8d74eae916
commit cd2c73ebff
5 changed files with 10 additions and 29 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_aue.c,v 1.187 2022/03/03 05:55:01 riastradh Exp $ */
/* $NetBSD: if_aue.c,v 1.188 2022/03/03 05:55:19 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.187 2022/03/03 05:55:01 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.188 2022/03/03 05:55:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -954,10 +954,6 @@ aue_uno_init(struct ifnet *ifp)
AUEHIST_CALLARGSN(5, "aue%jd: enter link=%jd",
device_unit(un->un_dev), usbnet_havelink(un), 0, 0);
/* Cancel pending I/O */
if (ifp->if_flags & IFF_RUNNING)
return 0;
/* Reset the interface. */
aue_reset(sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_mue.c,v 1.78 2022/03/03 05:55:01 riastradh Exp $ */
/* $NetBSD: if_mue.c,v 1.79 2022/03/03 05:55:19 riastradh Exp $ */
/* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */
/*
@ -20,7 +20,7 @@
/* Driver for Microchip LAN7500/LAN7800 chipsets. */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.78 2022/03/03 05:55:01 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.79 2022/03/03 05:55:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -1233,10 +1233,6 @@ mue_uno_init(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
/* Cancel pending I/O and free all TX/RX buffers. */
if (ifp->if_flags & IFF_RUNNING)
usbnet_stop(un, ifp, 1);
mue_reset(un);
/* Set MAC address. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_udav.c,v 1.93 2022/03/03 05:55:01 riastradh Exp $ */
/* $NetBSD: if_udav.c,v 1.94 2022/03/03 05:55:19 riastradh Exp $ */
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
/*
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.93 2022/03/03 05:55:01 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.94 2022/03/03 05:55:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -471,10 +471,6 @@ udav_uno_init(struct ifnet *ifp)
DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__));
/* Cancel pending I/O and free all TX/RX buffers */
if (ifp->if_flags & IFF_RUNNING)
usbnet_stop(un, ifp, 1);
memcpy(eaddr, CLLADDR(ifp->if_sadl), sizeof(eaddr));
udav_csr_write(un, UDAV_PAR, eaddr, ETHER_ADDR_LEN);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ure.c,v 1.53 2022/03/03 05:55:01 riastradh Exp $ */
/* $NetBSD: if_ure.c,v 1.54 2022/03/03 05:55:19 riastradh Exp $ */
/* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */
/*-
@ -30,7 +30,7 @@
/* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.53 2022/03/03 05:55:01 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.54 2022/03/03 05:55:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -413,10 +413,6 @@ ure_uno_init(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
uint8_t eaddr[8];
/* Cancel pending I/O. */
if (ifp->if_flags & IFF_RUNNING)
usbnet_stop(un, ifp, 1);
/* Set MAC address. */
memset(eaddr, 0, sizeof(eaddr));
memcpy(eaddr, CLLADDR(ifp->if_sadl), ETHER_ADDR_LEN);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_urndis.c,v 1.41 2022/03/03 05:54:45 riastradh Exp $ */
/* $NetBSD: if_urndis.c,v 1.42 2022/03/03 05:55:19 riastradh Exp $ */
/* $OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
/*
@ -21,7 +21,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.41 2022/03/03 05:54:45 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.42 2022/03/03 05:55:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -859,9 +859,6 @@ urndis_init_un(struct ifnet *ifp, struct usbnet *un)
{
int err;
if (ifp->if_flags & IFF_RUNNING)
return 0;
err = urndis_ctrl_init(un);
if (err != RNDIS_STATUS_SUCCESS)
return EIO;