Catch a few cases where we need to release memory resources on errors.
Place parentheses around variables in macros. MFC after: 3 days
This commit is contained in:
parent
b03747e983
commit
02a42e683f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277206
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user