Module Name: src
Committed By: msaitoh
Date: Mon Oct 23 09:22:24 UTC 2017
Modified Files:
src/sys/dev/ic: smc90cx6.c smc90cx6var.h
src/sys/net: if_arc.h if_arcsubr.c
Log Message:
If if_attach() failed in the attach function, return.
To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/ic/smc90cx6.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/smc90cx6var.h
cvs rdiff -u -r1.22 -r1.23 src/sys/net/if_arc.h
cvs rdiff -u -r1.77 -r1.78 src/sys/net/if_arcsubr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/smc90cx6.c
diff -u src/sys/dev/ic/smc90cx6.c:1.70 src/sys/dev/ic/smc90cx6.c:1.71
--- src/sys/dev/ic/smc90cx6.c:1.70 Tue May 23 02:43:13 2017
+++ src/sys/dev/ic/smc90cx6.c Mon Oct 23 09:22:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: smc90cx6.c,v 1.70 2017/05/23 02:43:13 ozaki-r Exp $ */
+/* $NetBSD: smc90cx6.c,v 1.71 2017/10/23 09:22:24 msaitoh Exp $ */
/*-
* Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smc90cx6.c,v 1.70 2017/05/23 02:43:13 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smc90cx6.c,v 1.71 2017/10/23 09:22:24 msaitoh Exp $");
/* #define BAHSOFTCOPY */
#define BAHRETRANSMIT /**/
@@ -140,11 +140,11 @@ void bah_reconwatch(void *);
#define GETMEM(off) bus_space_read_1(bst_m, mem, (off))
#define PUTMEM(off, v) bus_space_write_1(bst_m, mem, (off), (v))
-void
+int
bah_attach_subr(struct bah_softc *sc)
{
struct ifnet *ifp = &sc->sc_arccom.ac_if;
- int s;
+ int s, rv;
u_int8_t linkaddress;
bus_space_tag_t bst_r = sc->sc_bst_r;
@@ -197,7 +197,9 @@ bah_attach_subr(struct bah_softc *sc)
ifp->if_mtu = ARCMTU;
- arc_ifattach(ifp, linkaddress);
+ rv = arc_ifattach(ifp, linkaddress);
+ if (rv != 0)
+ return rv;
if_deferred_start_init(ifp, NULL);
#ifdef BAHSOFTCOPY
@@ -207,6 +209,7 @@ bah_attach_subr(struct bah_softc *sc)
#endif
callout_init(&sc->sc_recon_ch, 0);
+ return 0;
}
/*
Index: src/sys/dev/ic/smc90cx6var.h
diff -u src/sys/dev/ic/smc90cx6var.h:1.11 src/sys/dev/ic/smc90cx6var.h:1.12
--- src/sys/dev/ic/smc90cx6var.h:1.11 Sat Oct 27 17:18:22 2012
+++ src/sys/dev/ic/smc90cx6var.h Mon Oct 23 09:22:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: smc90cx6var.h,v 1.11 2012/10/27 17:18:22 chs Exp $ */
+/* $NetBSD: smc90cx6var.h,v 1.12 2017/10/23 09:22:24 msaitoh Exp $ */
/*-
* Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ struct bah_softc {
u_char sc_retransmits[2]; /* unused at the moment */
};
-void bah_attach_subr(struct bah_softc *);
+int bah_attach_subr(struct bah_softc *);
int bahintr(void *);
#endif
Index: src/sys/net/if_arc.h
diff -u src/sys/net/if_arc.h:1.22 src/sys/net/if_arc.h:1.23
--- src/sys/net/if_arc.h:1.22 Wed Feb 20 17:05:52 2008
+++ src/sys/net/if_arc.h Mon Oct 23 09:22:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arc.h,v 1.22 2008/02/20 17:05:52 matt Exp $ */
+/* $NetBSD: if_arc.h,v 1.23 2017/10/23 09:22:24 msaitoh Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -118,7 +118,7 @@ struct arccom {
extern uint8_t arcbroadcastaddr;
extern int arc_ipmtu; /* XXX new ip only, no RFC 1051! */
-void arc_ifattach(struct ifnet *, uint8_t);
+int arc_ifattach(struct ifnet *, uint8_t);
char *arc_sprintf(uint8_t *);
int arc_isphds(uint8_t);
#endif
Index: src/sys/net/if_arcsubr.c
diff -u src/sys/net/if_arcsubr.c:1.77 src/sys/net/if_arcsubr.c:1.78
--- src/sys/net/if_arcsubr.c:1.77 Tue Feb 14 03:05:06 2017
+++ src/sys/net/if_arcsubr.c Mon Oct 23 09:22:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arcsubr.c,v 1.77 2017/02/14 03:05:06 ozaki-r Exp $ */
+/* $NetBSD: if_arcsubr.c,v 1.78 2017/10/23 09:22:24 msaitoh Exp $ */
/*
* Copyright (c) 1994, 1995 Ignatios Souvatzis
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.77 2017/02/14 03:05:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.78 2017/10/23 09:22:24 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -610,10 +610,11 @@ arc_sprintf(uint8_t *ap)
/*
* Perform common duties while attaching to interface list
*/
-void
+int
arc_ifattach(struct ifnet *ifp, uint8_t lla)
{
struct arccom *ac;
+ int rv;
ifp->if_type = IFT_ARCNET;
ifp->if_addrlen = 1;
@@ -635,10 +636,15 @@ arc_ifattach(struct ifnet *ifp, uint8_t
log(LOG_ERR,"%s: link address 0 reserved for broadcasts. Please change it and ifconfig %s down up\n",
ifp->if_xname, ifp->if_xname);
}
- if_attach(ifp);
+ rv = if_attach(ifp);
+ if (rv != 0)
+ return rv;
+
if_set_sadl(ifp, &lla, sizeof(lla), true);
ifp->if_broadcastaddr = &arcbroadcastaddr;
bpf_attach(ifp, DLT_ARCNET, ARC_HDRLEN);
+
+ return 0;
}