Author: ian
Date: Sat Jun 15 20:17:00 2019
New Revision: 349076
URL: https://svnweb.freebsd.org/changeset/base/349076

Log:
  Use device_delete_children() instead of a locally-rolled copy of it that
  leaks the device-list memory.

Modified:
  head/sys/dev/pwm/pwmbus.c

Modified: head/sys/dev/pwm/pwmbus.c
==============================================================================
--- head/sys/dev/pwm/pwmbus.c   Sat Jun 15 20:13:42 2019        (r349075)
+++ head/sys/dev/pwm/pwmbus.c   Sat Jun 15 20:17:00 2019        (r349076)
@@ -92,20 +92,12 @@ pwmbus_attach(device_t dev)
 static int
 pwmbus_detach(device_t dev)
 {
-       device_t *devlist;
-       int i, rv, ndevs;
+       int rv;
 
-       rv = bus_generic_detach(dev);
-       if (rv != 0)
-               return (rv);
+       if ((rv = bus_generic_detach(dev)) == 0)
+               rv = device_delete_children(dev);
 
-       rv = device_get_children(dev, &devlist, &ndevs);
-       if (rv != 0)
-               return (rv);
-       for (i = 0; i < ndevs; i++)
-               device_delete_child(dev, devlist[i]);
-
-       return (0);
+       return (rv);
 }
 
 static int
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to