svn commit: r277206 - head/sys/arm/broadcom/bcm2835

Luiz Otavio O Souza loos at FreeBSD.org
Thu Jan 15 00:48:55 UTC 2015


Author: loos
Date: Thu Jan 15 00:48:53 2015
New Revision: 277206
URL: https://svnweb.freebsd.org/changeset/base/277206

Log:
  Catch a few cases where we need to release memory resources on errors.
  
  Place parentheses around variables in macros.
  
  MFC after:	3 days

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c	Thu Jan 15 00:46:30 2015	(r277205)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c	Thu Jan 15 00:48:53 2015	(r277206)
@@ -252,6 +252,7 @@ bcm_bsc_attach(device_t dev)
 	}
 	if (i == nitems(bcm_bsc_pins)) {
 		device_printf(dev, "only bsc0 and bsc1 are supported\n");
+		bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
 		return (ENXIO);
 	}
 
@@ -262,6 +263,7 @@ bcm_bsc_attach(device_t dev)
 	gpio = devclass_get_device(devclass_find("gpio"), 0);
 	if (!gpio) {
 		device_printf(dev, "cannot find gpio0\n");
+		bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
 		return (ENXIO);
 	}
 	bcm_gpio_set_alternate(gpio, bcm_bsc_pins[i].sda, BCM_GPIO_ALT0);

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h	Thu Jan 15 00:46:30 2015	(r277205)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h	Thu Jan 15 00:48:53 2015	(r277206)
@@ -58,9 +58,9 @@ struct bcm_bsc_softc {
 #define	BCM_I2C_ERROR		0x04
 
 #define	BCM_BSC_WRITE(_sc, _off, _val)		\
-    bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val)
+    bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, _off, _val)
 #define	BCM_BSC_READ(_sc, _off)			\
-    bus_space_read_4(_sc->sc_bst, _sc->sc_bsh, _off)
+    bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, _off)
 
 #define	BCM_BSC_LOCK(_sc)			\
     mtx_lock(&(_sc)->sc_mtx)


More information about the svn-src-head mailing list