aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/gpio/qoriq_gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/gpio/qoriq_gpio.c')
-rw-r--r--sys/dev/gpio/qoriq_gpio.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/gpio/qoriq_gpio.c b/sys/dev/gpio/qoriq_gpio.c
index 63a9c3f857f6..8b44cd256c79 100644
--- a/sys/dev/gpio/qoriq_gpio.c
+++ b/sys/dev/gpio/qoriq_gpio.c
@@ -35,10 +35,10 @@
#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/gpio.h>
+#include <sys/stdarg.h>
#include <machine/bus.h>
#include <machine/resource.h>
-#include <machine/stdarg.h>
#include <dev/gpio/gpiobusvar.h>
#include <dev/gpio/qoriq_gpio.h>
@@ -369,11 +369,6 @@ qoriq_gpio_attach(device_t dev)
for (i = 0; i <= MAXPIN; i++)
sc->sc_pins[i].gp_caps = DEFAULT_CAPS;
- sc->busdev = gpiobus_attach_bus(dev);
- if (sc->busdev == NULL) {
- qoriq_gpio_detach(dev);
- return (ENOMEM);
- }
/*
* Enable the GPIO Input Buffer for all GPIOs.
* This is safe on devices without a GPIBE register, because those
@@ -384,6 +379,12 @@ qoriq_gpio_attach(device_t dev)
OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev);
+ sc->busdev = gpiobus_attach_bus(dev);
+ if (sc->busdev == NULL) {
+ qoriq_gpio_detach(dev);
+ return (ENOMEM);
+ }
+
return (0);
}