git: f8967810f5b5 - main - mge: eliminate write only variables ifp, sc and error

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 05 Apr 2022 04:32:23 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=f8967810f5b5806c59fb6c8dbcc123dbc9256bb3

commit f8967810f5b5806c59fb6c8dbcc123dbc9256bb3
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 02:08:21 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 04:29:41 +0000

    mge: eliminate write only variables ifp, sc and error
    
    Sponsored by:           Netflix
---
 sys/dev/mge/if_mge.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/sys/dev/mge/if_mge.c b/sys/dev/mge/if_mge.c
index c43163afe3a7..3c447a48f564 100644
--- a/sys/dev/mge/if_mge.c
+++ b/sys/dev/mge/if_mge.c
@@ -628,12 +628,11 @@ mge_alloc_desc_dma(struct mge_softc *sc, struct mge_desc_wrapper* tab,
 static int
 mge_allocate_dma(struct mge_softc *sc)
 {
-	int error;
 	struct mge_desc_wrapper *dw;
 	int i;
 
 	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
-	error = bus_dma_tag_create(bus_get_dma_tag(sc->dev),	/* parent */
+	bus_dma_tag_create(bus_get_dma_tag(sc->dev),	/* parent */
 	    16, 0,				/* alignment, boundary */
 	    BUS_SPACE_MAXADDR_32BIT,		/* lowaddr */
 	    BUS_SPACE_MAXADDR,			/* highaddr */
@@ -929,9 +928,8 @@ mge_attach(device_t dev)
 	}
 
 	if (sc->switch_attached) {
-		device_t child;
 		MGE_WRITE(sc, MGE_REG_PHYDEV, MGE_SWITCH_PHYDEV);
-		child = device_add_child(dev, "mdio", -1);
+		device_add_child(dev, "mdio", -1);
 		bus_generic_attach(dev);
 	}
 
@@ -1582,8 +1580,6 @@ mge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
 static int
 mge_miibus_readreg(device_t dev, int phy, int reg)
 {
-	struct mge_softc *sc;
-	sc = device_get_softc(dev);
 
 	KASSERT(!switch_attached, ("miibus used with switch attached"));
 
@@ -1593,8 +1589,6 @@ mge_miibus_readreg(device_t dev, int phy, int reg)
 static int
 mge_miibus_writereg(device_t dev, int phy, int reg, int value)
 {
-	struct mge_softc *sc;
-	sc = device_get_softc(dev);
 
 	KASSERT(!switch_attached, ("miibus used with switch attached"));
 
@@ -1648,15 +1642,12 @@ static int
 mge_encap(struct mge_softc *sc, struct mbuf *m0)
 {
 	struct mge_desc_wrapper *dw = NULL;
-	struct ifnet *ifp;
 	bus_dma_segment_t segs[MGE_TX_DESC_NUM];
 	bus_dmamap_t mapp;
 	int error;
 	int seg, nsegs;
 	int desc_no;
 
-	ifp = sc->ifp;
-
 	/* Fetch unused map */
 	desc_no = sc->tx_desc_curr;
 	dw = &sc->mge_tx_desc[desc_no];