Module Name: src Committed By: jmcneill Date: Sat Jun 30 16:27:49 UTC 2018
Modified Files: src/sys/dev/ic: dwc_gmac.c dwc_gmac_var.h Log Message: dwc_gmac_attach: return non-zero on failure To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/dwc_gmac.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_gmac_var.h 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/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.50 src/sys/dev/ic/dwc_gmac.c:1.51 --- src/sys/dev/ic/dwc_gmac.c:1.50 Tue Jun 26 06:48:00 2018 +++ src/sys/dev/ic/dwc_gmac.c Sat Jun 30 16:27:48 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.50 2018/06/26 06:48:00 msaitoh Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.51 2018/06/30 16:27:48 jmcneill 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.50 2018/06/26 06:48:00 msaitoh Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.51 2018/06/30 16:27:48 jmcneill Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -137,7 +137,7 @@ static void dwc_gmac_dump_ffilt(struct d #define DWCGMAC_MPSAFE 1 #endif -void +int dwc_gmac_attach(struct dwc_gmac_softc *sc, uint32_t mii_clk) { uint8_t enaddr[ETHER_ADDR_LEN]; @@ -189,7 +189,7 @@ dwc_gmac_attach(struct dwc_gmac_softc *s * Init chip and do initial setup */ if (dwc_gmac_reset(sc) != 0) - return; /* not much to cleanup, haven't attached yet */ + return ENXIO; /* not much to cleanup, haven't attached yet */ dwc_gmac_write_hwaddr(sc, enaddr); aprint_normal_dev(sc->sc_dev, "Ethernet address: %s\n", ether_sprintf(enaddr)); @@ -280,7 +280,8 @@ dwc_gmac_attach(struct dwc_gmac_softc *s GMAC_DEF_DMA_INT_MASK); mutex_exit(sc->sc_lock); - return; + return 0; + fail_2: ifmedia_removeall(&mii->mii_media); mii_detach(mii, MII_PHY_ANY, MII_OFFSET_ANY); @@ -292,6 +293,8 @@ fail: dwc_gmac_free_tx_ring(sc, &sc->sc_txq); dwc_gmac_free_dma_rings(sc); mutex_destroy(&sc->sc_mdio_lock); + + return ENXIO; } Index: src/sys/dev/ic/dwc_gmac_var.h diff -u src/sys/dev/ic/dwc_gmac_var.h:1.8 src/sys/dev/ic/dwc_gmac_var.h:1.9 --- src/sys/dev/ic/dwc_gmac_var.h:1.8 Sat Jun 16 00:15:00 2018 +++ src/sys/dev/ic/dwc_gmac_var.h Sat Jun 30 16:27:48 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac_var.h,v 1.8 2018/06/16 00:15:00 jmcneill Exp $ */ +/* $NetBSD: dwc_gmac_var.h,v 1.9 2018/06/30 16:27:48 jmcneill Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -100,5 +100,5 @@ struct dwc_gmac_softc { void (*sc_set_speed)(struct dwc_gmac_softc *, int); }; -void dwc_gmac_attach(struct dwc_gmac_softc*, uint32_t /*mii_clk*/); +int dwc_gmac_attach(struct dwc_gmac_softc*, uint32_t /*mii_clk*/); int dwc_gmac_intr(struct dwc_gmac_softc*);