Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 May 2016 04:59:36 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299714 - in head/sys/dev/extres: clk hwreset phy regulator
Message-ID:  <201605140459.u4E4xaGg045771@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Sat May 14 04:59:36 2016
New Revision: 299714
URL: https://svnweb.freebsd.org/changeset/base/299714

Log:
  Use OF_prop_free instead of direct call to free(9)
  
  Reviewed by:	mmel@

Modified:
  head/sys/dev/extres/clk/clk.c
  head/sys/dev/extres/clk/clk_fixed.c
  head/sys/dev/extres/hwreset/hwreset.c
  head/sys/dev/extres/phy/phy.c
  head/sys/dev/extres/regulator/regulator.c

Modified: head/sys/dev/extres/clk/clk.c
==============================================================================
--- head/sys/dev/extres/clk/clk.c	Sat May 14 04:29:13 2016	(r299713)
+++ head/sys/dev/extres/clk/clk.c	Sat May 14 04:59:36 2016	(r299714)
@@ -1241,7 +1241,7 @@ clk_get_by_ofw_index(device_t dev, int i
 
 done:
 	if (cells != NULL)
-		free(cells, M_OFWPROP);
+		OF_prop_free(cells);
 	return (rv);
 }
 
@@ -1297,8 +1297,8 @@ clk_parse_ofw_out_names(device_t dev, ph
 	if (rv != name_items) {
 		device_printf(dev, " Size of 'clock-output-names' and "
 		    "'clock-indices' differs\n");
-		free(*out_names, M_OFWPROP);
-		free(*indices, M_OFWPROP);
+		OF_prop_free(*out_names);
+		OF_prop_free(*indices);
 		return (0);
 	}
 	return (name_items);
@@ -1325,12 +1325,12 @@ clk_parse_ofw_clk_name(device_t dev, pha
 	rv = ofw_bus_string_list_to_array(node, "clock-output-names",
 	    &out_names);
 	if (rv != 1) {
-		free(out_names, M_OFWPROP);
+		OF_prop_free(out_names);
 		device_printf(dev, "Malformed 'clock-output-names' property\n");
 		return (ENXIO);
 	}
 	*name = strdup(out_names[0], M_OFWPROP);
-	free(out_names, M_OFWPROP);
+	OF_prop_free(out_names);
 	return (0);
 }
 #endif

Modified: head/sys/dev/extres/clk/clk_fixed.c
==============================================================================
--- head/sys/dev/extres/clk/clk_fixed.c	Sat May 14 04:29:13 2016	(r299713)
+++ head/sys/dev/extres/clk/clk_fixed.c	Sat May 14 04:59:36 2016	(r299714)
@@ -254,13 +254,13 @@ clk_fixed_attach(device_t dev)
 #ifdef CLK_DEBUG
 	clkdom_dump(sc->clkdom);
 #endif
-	free(__DECONST(char *, def.clkdef.name), M_OFWPROP);
-	free(def.clkdef.parent_names, M_OFWPROP);
+	OF_prop_free(__DECONST(char *, def.clkdef.name));
+	OF_prop_free(def.clkdef.parent_names);
 	return (bus_generic_attach(dev));
 
 fail:
-	free(__DECONST(char *, def.clkdef.name), M_OFWPROP);
-	free(def.clkdef.parent_names, M_OFWPROP);
+	OF_prop_free(__DECONST(char *, def.clkdef.name));
+	OF_prop_free(def.clkdef.parent_names);
 	return (rv);
 }
 

Modified: head/sys/dev/extres/hwreset/hwreset.c
==============================================================================
--- head/sys/dev/extres/hwreset/hwreset.c	Sat May 14 04:29:13 2016	(r299713)
+++ head/sys/dev/extres/hwreset/hwreset.c	Sat May 14 04:59:36 2016	(r299714)
@@ -132,12 +132,12 @@ hwreset_get_by_ofw_idx(device_t consumer
 	/* Tranlate provider to device */
 	rstdev = OF_device_from_xref(xnode);
 	if (rstdev == NULL) {
-		free(cells, M_OFWPROP);
+		OF_prop_free(cells);
 		return (ENODEV);
 	}
 	/* Map reset to number */
 	rv = HWRESET_MAP(rstdev, xnode, ncells, cells, &id);
-	free(cells, M_OFWPROP);
+	OF_prop_free(cells);
 	if (rv != 0)
 		return (rv);
 

Modified: head/sys/dev/extres/phy/phy.c
==============================================================================
--- head/sys/dev/extres/phy/phy.c	Sat May 14 04:29:13 2016	(r299713)
+++ head/sys/dev/extres/phy/phy.c	Sat May 14 04:59:36 2016	(r299714)
@@ -146,12 +146,12 @@ phy_get_by_ofw_idx(device_t consumer_dev
 	/* Tranlate provider to device. */
 	phydev = OF_device_from_xref(xnode);
 	if (phydev == NULL) {
-		free(cells, M_OFWPROP);
+		OF_prop_free(cells);
 		return (ENODEV);
 	}
 	/* Map phy to number. */
 	rv = PHY_MAP(phydev, xnode, ncells, cells, &id);
-	free(cells, M_OFWPROP);
+	OF_prop_free(cells);
 	if (rv != 0)
 		return (rv);
 
@@ -199,12 +199,12 @@ phy_get_by_ofw_property(device_t consume
 	/* Tranlate provider to device. */
 	phydev = OF_device_from_xref(cells[0]);
 	if (phydev == NULL) {
-		free(cells, M_OFWPROP);
+		OF_prop_free(cells);
 		return (ENODEV);
 	}
 	/* Map phy to number. */
 	rv = PHY_MAP(phydev, cells[0], ncells - 1 , cells + 1, &id);
-	free(cells, M_OFWPROP);
+	OF_prop_free(cells);
 	if (rv != 0)
 		return (rv);
 

Modified: head/sys/dev/extres/regulator/regulator.c
==============================================================================
--- head/sys/dev/extres/regulator/regulator.c	Sat May 14 04:29:13 2016	(r299713)
+++ head/sys/dev/extres/regulator/regulator.c	Sat May 14 04:59:36 2016	(r299714)
@@ -970,13 +970,13 @@ regulator_get_by_ofw_property(device_t c
 	/* Translate xref to device */
 	regdev = OF_device_from_xref(cells[0]);
 	if (regdev == NULL) {
-		free(cells, M_OFWPROP);
+		OF_prop_free(cells);
 		return (ENODEV);
 	}
 
 	/* Map regulator to number */
 	rv = REGDEV_MAP(regdev, cells[0], ncells - 1, cells + 1, &id);
-	free(cells, M_OFWPROP);
+	OF_prop_free(cells);
 	if (rv != 0)
 		return (rv);
 	return (regulator_get_by_id(cdev, regdev, id, reg));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605140459.u4E4xaGg045771>