Commit 69dd15a8 authored by Rob Herring (Arm)'s avatar Rob Herring (Arm) Committed by Mark Brown

ASoC: Use of_property_read_bool()

Use of_property_read_bool() to read boolean properties rather than
of_get_property(). This is part of a larger effort to remove callers
of of_get_property() and similar functions. of_get_property() leaks
the DT property data pointer which is a problem for dynamically
allocated nodes which may be freed.
Signed-off-by: default avatarRob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240731191312.1710417-20-robh@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a1c8929b
...@@ -840,14 +840,14 @@ static void ak4613_parse_of(struct ak4613_priv *priv, ...@@ -840,14 +840,14 @@ static void ak4613_parse_of(struct ak4613_priv *priv,
/* Input 1 - 2 */ /* Input 1 - 2 */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
snprintf(prop, sizeof(prop), "asahi-kasei,in%d-single-end", i + 1); snprintf(prop, sizeof(prop), "asahi-kasei,in%d-single-end", i + 1);
if (!of_get_property(np, prop, NULL)) if (!of_property_read_bool(np, prop))
priv->ic |= 1 << i; priv->ic |= 1 << i;
} }
/* Output 1 - 6 */ /* Output 1 - 6 */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
snprintf(prop, sizeof(prop), "asahi-kasei,out%d-single-end", i + 1); snprintf(prop, sizeof(prop), "asahi-kasei,out%d-single-end", i + 1);
if (!of_get_property(np, prop, NULL)) if (!of_property_read_bool(np, prop))
priv->oc |= 1 << i; priv->oc |= 1 << i;
} }
......
...@@ -3371,10 +3371,10 @@ unsigned int snd_soc_daifmt_parse_format(struct device_node *np, ...@@ -3371,10 +3371,10 @@ unsigned int snd_soc_daifmt_parse_format(struct device_node *np,
* SND_SOC_DAIFMT_INV_MASK area * SND_SOC_DAIFMT_INV_MASK area
*/ */
snprintf(prop, sizeof(prop), "%sbitclock-inversion", prefix); snprintf(prop, sizeof(prop), "%sbitclock-inversion", prefix);
bit = !!of_get_property(np, prop, NULL); bit = of_property_read_bool(np, prop);
snprintf(prop, sizeof(prop), "%sframe-inversion", prefix); snprintf(prop, sizeof(prop), "%sframe-inversion", prefix);
frame = !!of_get_property(np, prop, NULL); frame = of_property_read_bool(np, prop);
switch ((bit << 4) + frame) { switch ((bit << 4) + frame) {
case 0x11: case 0x11:
...@@ -3411,12 +3411,12 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np, ...@@ -3411,12 +3411,12 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np,
* check "[prefix]frame-master" * check "[prefix]frame-master"
*/ */
snprintf(prop, sizeof(prop), "%sbitclock-master", prefix); snprintf(prop, sizeof(prop), "%sbitclock-master", prefix);
bit = !!of_get_property(np, prop, NULL); bit = of_property_read_bool(np, prop);
if (bit && bitclkmaster) if (bit && bitclkmaster)
*bitclkmaster = of_parse_phandle(np, prop, 0); *bitclkmaster = of_parse_phandle(np, prop, 0);
snprintf(prop, sizeof(prop), "%sframe-master", prefix); snprintf(prop, sizeof(prop), "%sframe-master", prefix);
frame = !!of_get_property(np, prop, NULL); frame = of_property_read_bool(np, prop);
if (frame && framemaster) if (frame && framemaster)
*framemaster = of_parse_phandle(np, prop, 0); *framemaster = of_parse_phandle(np, prop, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment