svn commit: r349076 - head/sys/dev/pwm

Ian Lepore ian at FreeBSD.org
Sat Jun 15 20:17:01 UTC 2019


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


More information about the svn-src-head mailing list