Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170948464
D6315.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D6315.diff
View Options
Index: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
===================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
@@ -632,7 +632,7 @@
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 @@
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 @@
return (-1);
if (strcmp(name, "reserved") == 0)
reserved = node;
- free(name, M_OFWPROP);
+ OF_prop_free(name);
node = OF_peer(node);
}
if (reserved == 0)
Index: head/sys/arm/ti/cpsw/if_cpsw.c
===================================================================
--- head/sys/arm/ti/cpsw/if_cpsw.c
+++ head/sys/arm/ti/cpsw/if_cpsw.c
@@ -727,10 +727,10 @@
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;
Index: head/sys/arm/ti/ti_adc.c
===================================================================
--- head/sys/arm/ti/ti_adc.c
+++ head/sys/arm/ti/ti_adc.c
@@ -747,11 +747,11 @@
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 @@
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);
}
}
Index: head/sys/arm/ti/ti_hwmods.c
===================================================================
--- head/sys/arm/ti/ti_hwmods.c
+++ head/sys/arm/ti/ti_hwmods.c
@@ -134,7 +134,7 @@
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 @@
len -= l;
}
- free(buf, M_OFWPROP);
+ OF_prop_free(buf);
return (result);
}
@@ -200,6 +200,6 @@
len -= l;
}
- free(buf, M_OFWPROP);
+ OF_prop_free(buf);
return (result);
}
Index: head/sys/arm/ti/ti_pinmux.c
===================================================================
--- head/sys/arm/ti/ti_pinmux.c
+++ head/sys/arm/ti/ti_pinmux.c
@@ -361,7 +361,7 @@
ti_pinmux_write_2(sc, cfg->reg, cfg->conf);
}
- free(cfgtuples, M_OFWPROP);
+ OF_prop_free(cfgtuples);
return (0);
}
Index: head/sys/dev/fdt/fdt_clock.c
===================================================================
--- head/sys/dev/fdt/fdt_clock.c
+++ head/sys/dev/fdt/fdt_clock.c
@@ -89,7 +89,7 @@
anyerrors = true;
}
}
- free(clks, M_OFWPROP);
+ OF_prop_free(clks);
return (anyerrors ? ENXIO : 0);
}
@@ -127,7 +127,7 @@
err = FDT_CLOCK_GET_INFO(clockdev, clocknum, info);
}
}
- free(clks, M_OFWPROP);
+ OF_prop_free(clks);
return (err);
}
Index: head/sys/dev/fdt/fdt_common.c
===================================================================
--- head/sys/dev/fdt/fdt_common.c
+++ head/sys/dev/fdt/fdt_common.c
@@ -348,7 +348,7 @@
if (strncmp((char *)stat, "okay", len) == 0)
ena = 1;
- free(stat, M_OFWPROP);
+ OF_prop_free(stat);
return (ena);
}
@@ -519,7 +519,7 @@
rv = 0;
out:
- free(regptr, M_OFWPROP);
+ OF_prop_free(regptr);
return (rv);
}
@@ -734,4 +734,4 @@
if (OF_getprop(chosen, "bootargs", bootargs, max_size) == -1)
return (ENXIO);
return (0);
-}
\ No newline at end of file
+}
Index: head/sys/dev/fdt/fdt_pinctrl.c
===================================================================
--- head/sys/dev/fdt/fdt_pinctrl.c
+++ head/sys/dev/fdt/fdt_pinctrl.c
@@ -56,7 +56,7 @@
if ((pinctrl = OF_device_from_xref(configs[i])) != NULL)
FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]);
}
- free(configs, M_OFWPROP);
+ OF_prop_free(configs);
return (0);
}
@@ -75,7 +75,7 @@
break;
offset += strlen(&names[offset]) + 1;
}
- free(names, M_OFWPROP);
+ OF_prop_free(names);
if (offset < nameslen)
return (fdt_pinctrl_configure(client, i));
else
@@ -136,7 +136,7 @@
if (OF_device_from_xref(configs[i]) == pinctrl)
FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]);
}
- free(configs, M_OFWPROP);
+ OF_prop_free(configs);
}
return (0);
}
Index: head/sys/dev/gpio/gpiokeys.c
===================================================================
--- head/sys/dev/gpio/gpiokeys.c
+++ head/sys/dev/gpio/gpiokeys.c
@@ -309,7 +309,7 @@
if (err) {
device_printf(sc->sc_dev, "<%s> failed to map pin\n", key_name);
if (name)
- free(name, M_OFWPROP);
+ OF_prop_free(name);
return;
}
@@ -320,7 +320,7 @@
gpio_pin_release(key->pin);
key->pin = NULL;
if (name)
- free(name, M_OFWPROP);
+ OF_prop_free(name);
return;
}
@@ -334,7 +334,7 @@
key->pin = NULL;
key->irq_res = NULL;
if (name)
- free(name, M_OFWPROP);
+ OF_prop_free(name);
return;
}
@@ -344,7 +344,7 @@
key->autorepeat, key->repeat, key->repeat_delay);
if (name)
- free(name, M_OFWPROP);
+ OF_prop_free(name);
}
static void
Index: head/sys/dev/gpio/gpioled.c
===================================================================
--- head/sys/dev/gpio/gpioled.c
+++ head/sys/dev/gpio/gpioled.c
@@ -151,7 +151,7 @@
if (strcasecmp(compat, "gpio-leds") == 0)
match = 1;
- free(compat, M_OFWPROP);
+ OF_prop_free(compat);
}
if (match == 0)
@@ -198,7 +198,7 @@
device_printf(dev,
"unknown value for default-state in FDT\n");
}
- free(default_state, M_OFWPROP);
+ OF_prop_free(default_state);
}
name = NULL;
@@ -214,7 +214,7 @@
device_get_nameunit(dev), state);
#ifdef FDT
if (name != NULL)
- free(name, M_OFWPROP);
+ OF_prop_free(name);
#endif
return (0);
Index: head/sys/dev/gpio/ofw_gpiobus.c
===================================================================
--- head/sys/dev/gpio/ofw_gpiobus.c
+++ head/sys/dev/gpio/ofw_gpiobus.c
@@ -76,21 +76,21 @@
/* Translate provider to device. */
pin.dev = OF_device_from_xref(xref);
if (pin.dev == NULL) {
- free(cells, M_OFWPROP);
+ OF_prop_free(cells);
return (ENODEV);
}
/* Test if GPIO bus already exist. */
busdev = GPIO_GET_BUS(pin.dev);
if (busdev == NULL) {
- free(cells, M_OFWPROP);
+ OF_prop_free(cells);
return (ENODEV);
}
/* Map GPIO pin. */
rv = gpio_map_gpios(pin.dev, cnode, OF_node_from_xref(xref), ncells,
cells, &pin.pin, &pin.flags);
- free(cells, M_OFWPROP);
+ OF_prop_free(cells);
if (rv != 0)
return (ENXIO);
@@ -379,7 +379,7 @@
sizeof(gpiocells)) < 0) {
device_printf(consumer,
"gpio reference is not a gpio-controller.\n");
- free(gpios, M_OFWPROP);
+ OF_prop_free(gpios);
return (-1);
}
if (ncells - i < gpiocells + 1) {
@@ -394,13 +394,13 @@
if (npins == 0)
device_printf(consumer, "no pin specified in %s.\n",
pname);
- free(gpios, M_OFWPROP);
+ OF_prop_free(gpios);
return (npins);
}
*pins = malloc(sizeof(struct gpiobus_pin) * npins, M_DEVBUF,
M_NOWAIT | M_ZERO);
if (*pins == NULL) {
- free(gpios, M_OFWPROP);
+ OF_prop_free(gpios);
return (-1);
}
/* Decode the gpio specifier on the second pass. */
@@ -455,12 +455,12 @@
j++;
i += gpiocells + 1;
}
- free(gpios, M_OFWPROP);
+ OF_prop_free(gpios);
return (npins);
fail:
- free(gpios, M_OFWPROP);
+ OF_prop_free(gpios);
free(*pins, M_DEVBUF);
return (-1);
}
Index: head/sys/dev/ofw/openfirm.h
===================================================================
--- head/sys/dev/ofw/openfirm.h
+++ head/sys/dev/ofw/openfirm.h
@@ -117,6 +117,7 @@
int elsz, void **buf);
ssize_t OF_getencprop_alloc(phandle_t node, const char *propname,
int elsz, void **buf);
+void OF_prop_free(void *buf);
int OF_nextprop(phandle_t node, const char *propname, char *buf,
size_t len);
int OF_setprop(phandle_t node, const char *name, const void *buf,
Index: head/sys/dev/ofw/openfirm.c
===================================================================
--- head/sys/dev/ofw/openfirm.c
+++ head/sys/dev/ofw/openfirm.c
@@ -477,6 +477,13 @@
return (retval);
}
+/* Free buffer allocated by OF_getencprop_alloc or OF_getprop_alloc */
+void OF_prop_free(void *buf)
+{
+
+ free(buf, M_OFWPROP);
+}
+
/* Get the next property of a package. */
int
OF_nextprop(phandle_t package, const char *previous, char *buf, size_t size)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 8, 7:28 PM (10 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38532852
Default Alt Text
D6315.diff (8 KB)
Attached To
Mode
D6315: Add OF_prop_free as a counterpart to OF_getprop_alloc/OF_getencprop_alloc
Attached
Detach File
Event Timeline
Log In to Comment