summaryrefslogtreecommitdiffstats
path: root/sys/arm/samsung
diff options
context:
space:
mode:
authorloos <loos@FreeBSD.org>2015-01-31 12:17:07 +0000
committerloos <loos@FreeBSD.org>2015-01-31 12:17:07 +0000
commita2924f5feeb568dc5a1dc2b53be66542d8825e87 (patch)
tree32cccced059cc9d62c6880a990ae89819afccc09 /sys/arm/samsung
parent4b26a78e587bd62c2b734d552d2ec5a699e6d93f (diff)
downloadFreeBSD-src-a2924f5feeb568dc5a1dc2b53be66542d8825e87.zip
FreeBSD-src-a2924f5feeb568dc5a1dc2b53be66542d8825e87.tar.gz
Clean up and fix the device detach routine and the failure path on GPIO
drivers. This paves the way for upcoming work.
Diffstat (limited to 'sys/arm/samsung')
-rw-r--r--sys/arm/samsung/exynos/exynos5_pad.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/arm/samsung/exynos/exynos5_pad.c b/sys/arm/samsung/exynos/exynos5_pad.c
index c28ebb1..0e58bf5 100644
--- a/sys/arm/samsung/exynos/exynos5_pad.c
+++ b/sys/arm/samsung/exynos/exynos5_pad.c
@@ -509,12 +509,12 @@ pad_attach(device_t dev)
sc->nports = 5;
break;
default:
- return (-1);
+ goto fail;
};
if (bus_alloc_resources(dev, sc->pad_spec, sc->res)) {
device_printf(dev, "could not allocate resources\n");
- return (ENXIO);
+ goto fail;
}
/* Memory interface */
@@ -534,9 +534,9 @@ pad_attach(device_t dev)
NULL, sc, &sc->gpio_ih[i]))) {
device_printf(dev,
"ERROR: Unable to register interrupt handler\n");
- return (ENXIO);
+ goto fail;
}
- };
+ }
for (i = 0; i < sc->gpio_npins; i++) {
sc->gpio_pins[i].gp_pin = i;
@@ -563,6 +563,17 @@ pad_attach(device_t dev)
device_add_child(dev, "gpiobus", -1);
return (bus_generic_attach(dev));
+
+fail:
+ for (i = 0; i < sc->nports; i++) {
+ if (sc->gpio_ih[i])
+ bus_teardown_intr(dev, sc->res[sc->nports + i],
+ sc->gpio_ih[i]);
+ }
+ bus_release_resources(dev, sc->pad_spec, sc->res);
+ mtx_destroy(&sc->sc_mtx);
+
+ return (ENXIO);
}
static int
OpenPOWER on IntegriCloud