Skip to content

Commit 79ff5e2

Browse files
robherringgregkh
authored andcommitted
ASoC: Use of_property_read_bool()
[ Upstream commit 69dd15a8ef0ae494179fd15023aa8172188db6b7 ] 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: Rob Herring (Arm) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Stable-dep-of: 6eab70345799 ("ASoC: soc-core: Stop using of_property_read_bool() for non-boolean properties") Signed-off-by: Sasha Levin <[email protected]>
1 parent e25139c commit 79ff5e2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

sound/soc/codecs/ak4613.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,14 +840,14 @@ static void ak4613_parse_of(struct ak4613_priv *priv,
840840
/* Input 1 - 2 */
841841
for (i = 0; i < 2; i++) {
842842
snprintf(prop, sizeof(prop), "asahi-kasei,in%d-single-end", i + 1);
843-
if (!of_get_property(np, prop, NULL))
843+
if (!of_property_read_bool(np, prop))
844844
priv->ic |= 1 << i;
845845
}
846846

847847
/* Output 1 - 6 */
848848
for (i = 0; i < 6; i++) {
849849
snprintf(prop, sizeof(prop), "asahi-kasei,out%d-single-end", i + 1);
850-
if (!of_get_property(np, prop, NULL))
850+
if (!of_property_read_bool(np, prop))
851851
priv->oc |= 1 << i;
852852
}
853853

sound/soc/soc-core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3143,10 +3143,10 @@ unsigned int snd_soc_daifmt_parse_format(struct device_node *np,
31433143
* SND_SOC_DAIFMT_INV_MASK area
31443144
*/
31453145
snprintf(prop, sizeof(prop), "%sbitclock-inversion", prefix);
3146-
bit = !!of_get_property(np, prop, NULL);
3146+
bit = of_property_read_bool(np, prop);
31473147

31483148
snprintf(prop, sizeof(prop), "%sframe-inversion", prefix);
3149-
frame = !!of_get_property(np, prop, NULL);
3149+
frame = of_property_read_bool(np, prop);
31503150

31513151
switch ((bit << 4) + frame) {
31523152
case 0x11:
@@ -3183,12 +3183,12 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np,
31833183
* check "[prefix]frame-master"
31843184
*/
31853185
snprintf(prop, sizeof(prop), "%sbitclock-master", prefix);
3186-
bit = !!of_get_property(np, prop, NULL);
3186+
bit = of_property_read_bool(np, prop);
31873187
if (bit && bitclkmaster)
31883188
*bitclkmaster = of_parse_phandle(np, prop, 0);
31893189

31903190
snprintf(prop, sizeof(prop), "%sframe-master", prefix);
3191-
frame = !!of_get_property(np, prop, NULL);
3191+
frame = of_property_read_bool(np, prop);
31923192
if (frame && framemaster)
31933193
*framemaster = of_parse_phandle(np, prop, 0);
31943194

0 commit comments

Comments
 (0)