lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wmem76u4.wl-kuninori.morimoto.gx@renesas.com>
Date: Wed, 22 Jan 2025 23:43:31 +0000
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
To: Geert Uytterhoeven <geert+renesas@...der.be>
Cc: Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>,
	Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>,
	Rob Herring <robh@...nel.org>,
	linux-sound@...r.kernel.org,
	linux-renesas-soc@...r.kernel.org,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ASoC: soc-core: Stop using of_property_read_bool() for non-boolean properties


Hi Geert, Mark

Thank you for the patch

> On R-Car:
> 
>     OF: /sound: Read of boolean property 'simple-audio-card,bitclock-master' with a value.
>     OF: /sound: Read of boolean property 'simple-audio-card,frame-master' with a value.
> 
> or:
> 
>     OF: /soc/sound@...00000/ports/port@...ndpoint: Read of boolean property 'bitclock-master' with a value.
>     OF: /soc/sound@...00000/ports/port@...ndpoint: Read of boolean property 'frame-master' with a value.
> 
> The use of of_property_read_bool() for non-boolean properties is
> deprecated in favor of of_property_present() when testing for property
> presence.
> 
> Replace testing for presence before calling of_property_read_u32() by
> testing for an -EINVAL return value from the latter, to simplify the
> code.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
> ---
(snip)
> -	if (of_property_read_bool(np, "dai-tdm-slot-num")) {
> -		ret = of_property_read_u32(np, "dai-tdm-slot-num", &val);
> -		if (ret)
> -			return ret;
> -
> -		if (slots)
> -			*slots = val;
> -	}
(snip)
> +	ret = of_property_read_u32(np, "dai-tdm-slot-num", &val);
> +	if (ret && ret != -EINVAL)
> +		return ret;
> +	if (!ret && slots)
> +		*slots = val;

Looks good to me

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>


If my understanding was correct, old/new code should have same behavior.
But because of the original code, new code looks complex for me.
The case which this function return error are

	(A) if property does not have a value
	(B) if the property data isn't large enough

I think "DT checker" will indicates error for both case ?
If so, we can simply ignore these 2 cases. Then, the code will be more
simple

	ret = of_property_read_u32(np, "dai-tdm-slot-num", &val);
-	if (ret && ret != -EINVAL)
-		return ret;
	if (!ret && slots)
		*slots = val;

I think this should be extra new patch (if people can agree about it).

Thank you for your help !!

Best regards
---
Kuninori Morimoto

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ