summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2016-05-11 18:20:02 +0000
committergonzo <gonzo@FreeBSD.org>2016-05-11 18:20:02 +0000
commit23a2d5f59362b8a60462708280c89083bb8d1b27 (patch)
tree3563d72b1347b885dce8a7a9c1acc2cd41747fe8 /sys/arm
parent8093b741c766ae4c82afcd7999ff372061614b25 (diff)
downloadFreeBSD-src-23a2d5f59362b8a60462708280c89083bb8d1b27.zip
FreeBSD-src-23a2d5f59362b8a60462708280c89083bb8d1b27.tar.gz
Add OF_prop_free function as a counterpart for OF_*prop_alloc
- Introduce new OF API function OF_prop_free to free memory allocated by OF_getprop_alloc and OF_getencprop_alloc. Current code just calls free(9) with M_OFWPROP memory class which assumes knowledge about OF_*prop_alloc functions' internals and leads to unneccessary code coupling - Convert some of the free(..., M_OFWPROP) instances to OF_prop_free Files affected by this commit are the ones I was able to test on real hardware. The rest of free(..., M_OFWPROP) instances will be handled with idividual maintainers Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D6315
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_gpio.c6
-rw-r--r--sys/arm/ti/cpsw/if_cpsw.c4
-rw-r--r--sys/arm/ti/ti_adc.c6
-rw-r--r--sys/arm/ti/ti_hwmods.c6
-rw-r--r--sys/arm/ti/ti_pinmux.c2
5 files changed, 12 insertions, 12 deletions
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
index 9619503..cab3116 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
@@ -632,7 +632,7 @@ bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc, phandle_t node,
if (npins < 0)
return (-1);
if (npins == 0) {
- free(pins, M_OFWPROP);
+ OF_prop_free(pins);
return (0);
}
for (i = 0; i < npins; i++)
@@ -660,7 +660,7 @@ bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc, phandle_t node,
printf("%d-%d.\n", range_start, range_stop);
else
printf("%d.\n", range_start);
- free(pins, M_OFWPROP);
+ OF_prop_free(pins);
return (0);
}
@@ -686,7 +686,7 @@ bcm_gpio_get_reserved_pins(struct bcm_gpio_softc *sc)
return (-1);
if (strcmp(name, "reserved") == 0)
reserved = node;
- free(name, M_OFWPROP);
+ OF_prop_free(name);
node = OF_peer(node);
}
if (reserved == 0)
diff --git a/sys/arm/ti/cpsw/if_cpsw.c b/sys/arm/ti/cpsw/if_cpsw.c
index 56a5dd7..9358183 100644
--- a/sys/arm/ti/cpsw/if_cpsw.c
+++ b/sys/arm/ti/cpsw/if_cpsw.c
@@ -727,10 +727,10 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, int port)
if (OF_getprop_alloc(child, "name", 1, (void **)&name) < 0)
continue;
if (sscanf(name, "slave@%x", &mdio_child_addr) != 1) {
- free(name, M_OFWPROP);
+ OF_prop_free(name);
continue;
}
- free(name, M_OFWPROP);
+ OF_prop_free(name);
if (mdio_child_addr != slave_mdio_addr[port])
continue;
diff --git a/sys/arm/ti/ti_adc.c b/sys/arm/ti/ti_adc.c
index c73b092..e8dd6d8 100644
--- a/sys/arm/ti/ti_adc.c
+++ b/sys/arm/ti/ti_adc.c
@@ -747,11 +747,11 @@ ti_adc_attach(device_t dev)
device_printf(sc->sc_dev,
"invalid nubmer of ti,wire-config: %d (should be %d)\n",
nwire_configs, sc->sc_tsc_wires);
- free(wire_configs, M_OFWPROP);
+ OF_prop_free(wire_configs);
return (EINVAL);
}
err = ti_adc_config_wires(sc, wire_configs, nwire_configs);
- free(wire_configs, M_OFWPROP);
+ OF_prop_free(wire_configs);
if (err)
return (EINVAL);
}
@@ -764,7 +764,7 @@ ti_adc_attach(device_t dev)
if (sc->sc_adc_nchannels > 0) {
for (i = 0; i < sc->sc_adc_nchannels; i++)
sc->sc_adc_channels[i] = channels[i];
- free(channels, M_OFWPROP);
+ OF_prop_free(channels);
}
}
diff --git a/sys/arm/ti/ti_hwmods.c b/sys/arm/ti/ti_hwmods.c
index db96235..e662d27 100644
--- a/sys/arm/ti/ti_hwmods.c
+++ b/sys/arm/ti/ti_hwmods.c
@@ -134,7 +134,7 @@ ti_hwmods_get_clock(device_t dev)
if (len > 0)
device_printf(dev, "WARNING: more than one ti,hwmod \n");
- free(buf, M_OFWPROP);
+ OF_prop_free(buf);
return (clk);
}
@@ -167,7 +167,7 @@ int ti_hwmods_contains(device_t dev, const char *hwmod)
len -= l;
}
- free(buf, M_OFWPROP);
+ OF_prop_free(buf);
return (result);
}
@@ -200,6 +200,6 @@ ti_hwmods_get_unit(device_t dev, const char *hwmod)
len -= l;
}
- free(buf, M_OFWPROP);
+ OF_prop_free(buf);
return (result);
}
diff --git a/sys/arm/ti/ti_pinmux.c b/sys/arm/ti/ti_pinmux.c
index ffeaf75..0eeedbe 100644
--- a/sys/arm/ti/ti_pinmux.c
+++ b/sys/arm/ti/ti_pinmux.c
@@ -361,7 +361,7 @@ ti_pinmux_configure_pins(device_t dev, phandle_t cfgxref)
ti_pinmux_write_2(sc, cfg->reg, cfg->conf);
}
- free(cfgtuples, M_OFWPROP);
+ OF_prop_free(cfgtuples);
return (0);
}
OpenPOWER on IntegriCloud