If driver is not able to allocate RX buffer, do not start driver.

While I'm here move RX buffer allocation and descriptor
initialization up to not touch hardware registers in case of RX
buffer allocation failure.
This commit is contained in:
Pyun YongHyeon 2011-01-13 23:15:09 +00:00
parent 9e18005d99
commit 4a814a5edb

View File

@ -2621,6 +2621,16 @@ re_init_locked(struct rl_softc *sc)
/* Put controller into known state. */
re_reset(sc);
/*
* For C+ mode, initialize the RX descriptors and mbufs.
*/
if (re_rx_list_init(sc) != 0) {
device_printf(sc->rl_dev, "no memory for RX buffers\n");
re_stop(sc);
return;
}
re_tx_list_init(sc);
/*
* Enable C+ RX and TX mode, as well as VLAN stripping and
* RX checksum offload. We must configure the C+ register
@ -2672,12 +2682,6 @@ re_init_locked(struct rl_softc *sc)
htole32(*(u_int32_t *)(&eaddr.eaddr[4])));
CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
/*
* For C+ mode, initialize the RX descriptors and mbufs.
*/
re_rx_list_init(sc);
re_tx_list_init(sc);
/*
* Load the addresses of the RX and TX lists into the chip.
*/