svn commit: r349058 - head/sys/arm/allwinner
Ian Lepore
ian at FreeBSD.org
Sat Jun 15 16:36:30 UTC 2019
Author: ian
Date: Sat Jun 15 16:36:29 2019
New Revision: 349058
URL: https://svnweb.freebsd.org/changeset/base/349058
Log:
In detach(), check for failure of bus_generic_detach(), only release
resources if they got allocated (because detach() gets called from attach()
to handle various failures), and delete the pwmbus child if it got created.
Modified:
head/sys/arm/allwinner/aw_pwm.c
Modified: head/sys/arm/allwinner/aw_pwm.c
==============================================================================
--- head/sys/arm/allwinner/aw_pwm.c Sat Jun 15 16:16:29 2019 (r349057)
+++ head/sys/arm/allwinner/aw_pwm.c Sat Jun 15 16:36:29 2019 (r349058)
@@ -192,12 +192,20 @@ static int
aw_pwm_detach(device_t dev)
{
struct aw_pwm_softc *sc;
+ int error;
sc = device_get_softc(dev);
- bus_generic_detach(sc->dev);
+ if (((error = bus_generic_detach(sc->dev)) != 0) {
+ device_printf(sc->dev, "cannot detach child devices\n");
+ return (error);
+ }
- bus_release_resources(dev, aw_pwm_spec, &sc->res);
+ if (sc->busdev != NULL)
+ device_delete_child(dev, sc->busdev);
+
+ if (sc->res != NULL)
+ bus_release_resources(dev, aw_pwm_spec, &sc->res);
return (0);
}
More information about the svn-src-head
mailing list