mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-19 02:29:40 +00:00
etherswitch: Stop checking for failures from malloc(M_WAITOK)
MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852 (cherry picked from commit48741f4cec
) (cherry picked from commite78c315e89
)
This commit is contained in:
parent
568cb55925
commit
f5f9d9d403
@ -185,10 +185,6 @@ adm6996fc_attach_phys(struct adm6996fc_softc *sc)
|
|||||||
if_initname(sc->ifp[port], name, port);
|
if_initname(sc->ifp[port], name, port);
|
||||||
sc->miibus[port] = malloc(sizeof(device_t), M_ADM6996FC,
|
sc->miibus[port] = malloc(sizeof(device_t), M_ADM6996FC,
|
||||||
M_WAITOK | M_ZERO);
|
M_WAITOK | M_ZERO);
|
||||||
if (sc->miibus[port] == NULL) {
|
|
||||||
err = ENOMEM;
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port],
|
err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port],
|
||||||
adm6996fc_ifmedia_upd, adm6996fc_ifmedia_sts, \
|
adm6996fc_ifmedia_upd, adm6996fc_ifmedia_sts, \
|
||||||
BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
|
BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
|
||||||
@ -261,12 +257,6 @@ adm6996fc_attach(device_t dev)
|
|||||||
sc->portphy = malloc(sizeof(int) * sc->numports, M_ADM6996FC,
|
sc->portphy = malloc(sizeof(int) * sc->numports, M_ADM6996FC,
|
||||||
M_WAITOK | M_ZERO);
|
M_WAITOK | M_ZERO);
|
||||||
|
|
||||||
if (sc->ifp == NULL || sc->ifname == NULL || sc->miibus == NULL ||
|
|
||||||
sc->portphy == NULL) {
|
|
||||||
err = ENOMEM;
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach the PHYs and complete the bus enumeration.
|
* Attach the PHYs and complete the bus enumeration.
|
||||||
*/
|
*/
|
||||||
@ -287,14 +277,10 @@ adm6996fc_attach(device_t dev)
|
|||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
if (sc->portphy != NULL)
|
free(sc->portphy, M_ADM6996FC);
|
||||||
free(sc->portphy, M_ADM6996FC);
|
free(sc->miibus, M_ADM6996FC);
|
||||||
if (sc->miibus != NULL)
|
free(sc->ifname, M_ADM6996FC);
|
||||||
free(sc->miibus, M_ADM6996FC);
|
free(sc->ifp, M_ADM6996FC);
|
||||||
if (sc->ifname != NULL)
|
|
||||||
free(sc->ifname, M_ADM6996FC);
|
|
||||||
if (sc->ifp != NULL)
|
|
||||||
free(sc->ifp, M_ADM6996FC);
|
|
||||||
|
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
@ -231,10 +231,6 @@ ksz8995ma_attach_phys(struct ksz8995ma_softc *sc)
|
|||||||
if_initname(sc->ifp[port], name, port);
|
if_initname(sc->ifp[port], name, port);
|
||||||
sc->miibus[port] = malloc(sizeof(device_t), M_KSZ8995MA,
|
sc->miibus[port] = malloc(sizeof(device_t), M_KSZ8995MA,
|
||||||
M_WAITOK | M_ZERO);
|
M_WAITOK | M_ZERO);
|
||||||
if (sc->miibus[port] == NULL) {
|
|
||||||
err = ENOMEM;
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port],
|
err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port],
|
||||||
ksz8995ma_ifmedia_upd, ksz8995ma_ifmedia_sts, \
|
ksz8995ma_ifmedia_upd, ksz8995ma_ifmedia_sts, \
|
||||||
BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
|
BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
|
||||||
@ -311,12 +307,6 @@ ksz8995ma_attach(device_t dev)
|
|||||||
sc->portphy = malloc(sizeof(int) * sc->numports, M_KSZ8995MA,
|
sc->portphy = malloc(sizeof(int) * sc->numports, M_KSZ8995MA,
|
||||||
M_WAITOK | M_ZERO);
|
M_WAITOK | M_ZERO);
|
||||||
|
|
||||||
if (sc->ifp == NULL || sc->ifname == NULL || sc->miibus == NULL ||
|
|
||||||
sc->portphy == NULL) {
|
|
||||||
err = ENOMEM;
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach the PHYs and complete the bus enumeration.
|
* Attach the PHYs and complete the bus enumeration.
|
||||||
*/
|
*/
|
||||||
@ -345,14 +335,10 @@ ksz8995ma_attach(device_t dev)
|
|||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
if (sc->portphy != NULL)
|
free(sc->portphy, M_KSZ8995MA);
|
||||||
free(sc->portphy, M_KSZ8995MA);
|
free(sc->miibus, M_KSZ8995MA);
|
||||||
if (sc->miibus != NULL)
|
free(sc->ifname, M_KSZ8995MA);
|
||||||
free(sc->miibus, M_KSZ8995MA);
|
free(sc->ifp, M_KSZ8995MA);
|
||||||
if (sc->ifname != NULL)
|
|
||||||
free(sc->ifname, M_KSZ8995MA);
|
|
||||||
if (sc->ifp != NULL)
|
|
||||||
free(sc->ifp, M_KSZ8995MA);
|
|
||||||
|
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user