summaryrefslogtreecommitdiffstats
path: root/sys/dev/re
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2011-01-13 23:15:09 +0000
committeryongari <yongari@FreeBSD.org>2011-01-13 23:15:09 +0000
commitf65ba689ebb5cfac366ab2db6fd029a37be3b7c3 (patch)
tree1d2a657d4975c12503c2c5b91484d9a057f527b8 /sys/dev/re
parentb6c0fa3763880da9adcda19eabdbc84512583103 (diff)
downloadFreeBSD-src-f65ba689ebb5cfac366ab2db6fd029a37be3b7c3.zip
FreeBSD-src-f65ba689ebb5cfac366ab2db6fd029a37be3b7c3.tar.gz
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.
Diffstat (limited to 'sys/dev/re')
-rw-r--r--sys/dev/re/if_re.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index 92db00a..c825091 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -2622,6 +2622,16 @@ re_init_locked(struct rl_softc *sc)
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
* before all others.
@@ -2673,12 +2683,6 @@ re_init_locked(struct rl_softc *sc)
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.
*/
OpenPOWER on IntegriCloud