gpioow: gpio_pin_unmap order around config_detach

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

gpioow: gpio_pin_unmap order around config_detach

Artturi Alm
Hi,

i'm not suggesting the current order is easy to hit problems with,
but i think diff below would make sense anyway, so the 'owchild'
doesn't get even a remote chance in theory to endure any gpio failures?

-Artturi


diff --git sys/dev/gpio/gpioow.c sys/dev/gpio/gpioow.c
index 64d79ab0cb8..d37dcc60762 100644
--- sys/dev/gpio/gpioow.c
+++ sys/dev/gpio/gpioow.c
@@ -161,11 +161,11 @@ gpioow_detach(struct device *self, int flags)
  struct gpioow_softc *sc = (struct gpioow_softc *)self;
  int rv = 0;
 
- gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
-
  if (sc->sc_ow_dev != NULL)
  rv = config_detach(sc->sc_ow_dev, flags);
 
+ gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
+
  return (rv);
 }