mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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.
This commit is contained in:
parent
dd47326c82
commit
5ef9c1079e
1 changed files with 10 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue