Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jun 2011 04:31:57 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r223032 - head/sys/dev/ath
Message-ID:  <201106130431.p5D4Vv0t055604@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Mon Jun 13 04:31:57 2011
New Revision: 223032
URL: http://svn.freebsd.org/changeset/base/223032

Log:
  Fix ath_ahb(4) bus attach and eeprom error handling.
  
  Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>

Modified:
  head/sys/dev/ath/if_ath_ahb.c

Modified: head/sys/dev/ath/if_ath_ahb.c
==============================================================================
--- head/sys/dev/ath/if_ath_ahb.c	Mon Jun 13 02:23:51 2011	(r223031)
+++ head/sys/dev/ath/if_ath_ahb.c	Mon Jun 13 04:31:57 2011	(r223032)
@@ -123,7 +123,7 @@ ath_ahb_attach(device_t dev)
 	device_printf(sc->sc_dev, "eeprom @ %p\n", (void *) eepromaddr);
 	psc->sc_eeprom = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, (uintptr_t) eepromaddr,
 	  (uintptr_t) eepromaddr + (uintptr_t) ((ATH_EEPROM_DATA_SIZE * 2) - 1), 0, RF_ACTIVE);
-	if (psc->sc_sr == NULL) {
+	if (psc->sc_eeprom == NULL) {
 		device_printf(dev, "cannot map eeprom space\n");
 		goto bad0;
 	}
@@ -139,6 +139,10 @@ ath_ahb_attach(device_t dev)
 
 	/* Copy the EEPROM data out */
 	sc->sc_eepromdata = malloc(ATH_EEPROM_DATA_SIZE * 2, M_TEMP, M_NOWAIT | M_ZERO);
+	if (sc->sc_eepromdata == NULL) {
+		device_printf(dev, "cannot allocate memory for eeprom data\n");
+		goto bad1;
+	}
 	device_printf(sc->sc_dev, "eeprom data @ %p\n", (void *) rman_get_bushandle(psc->sc_eeprom));
 	/* XXX why doesn't this work? -adrian */
 #if 0



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106130431.p5D4Vv0t055604>