Date: Sat, 15 Jun 2019 16:36:29 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349058 - head/sys/arm/allwinner Message-ID: <201906151636.x5FGaTNY014759@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906151636.x5FGaTNY014759>