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: <a23852d7-c70c-a03c-99fb-b453bdc750a1@linux.intel.com>
Date:   Fri, 10 Mar 2023 16:01:45 +0100
From:   Amadeusz Sławiński 
        <amadeuszx.slawinski@...ux.intel.com>
To:     Rob Herring <robh@...nel.org>, Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
        Sylwester Nawrocki <s.nawrocki@...sung.com>,
        Olivier Moysan <olivier.moysan@...s.st.com>,
        Arnaud Pouliquen <arnaud.pouliquen@...s.st.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>
Cc:     devicetree@...r.kernel.org, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-stm32@...md-mailman.stormreply.com,
        linux-tegra@...r.kernel.org
Subject: Re: [PATCH] ASoC: Use of_property_present() for testing DT property
 presence

On 3/10/2023 3:47 PM, Rob Herring wrote:
> It is preferred to use typed property access functions (i.e.
> of_property_read_<type> functions) rather than low-level
> of_get_property/of_find_property functions for reading properties. As
> part of this, convert of_get_property/of_find_property calls to the
> recently added of_property_present() helper when we just want to test
> for presence of a property and nothing more.
> 
> Signed-off-by: Rob Herring <robh@...nel.org>
> ---
>   sound/soc/codecs/lpass-macro-common.c | 2 +-
>   sound/soc/generic/audio-graph-card.c  | 2 +-
>   sound/soc/generic/audio-graph-card2.c | 2 +-
>   sound/soc/mxs/mxs-sgtl5000.c          | 2 +-
>   sound/soc/samsung/i2s.c               | 2 +-
>   sound/soc/sh/fsi.c                    | 2 +-
>   sound/soc/stm/stm32_i2s.c             | 2 +-
>   sound/soc/stm/stm32_sai_sub.c         | 4 ++--
>   sound/soc/tegra/tegra_asoc_machine.c  | 2 +-
>   9 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/sound/soc/codecs/lpass-macro-common.c b/sound/soc/codecs/lpass-macro-common.c
> index 1b9082d237c1..f54baaad54d4 100644
> --- a/sound/soc/codecs/lpass-macro-common.c
> +++ b/sound/soc/codecs/lpass-macro-common.c
> @@ -16,7 +16,7 @@ struct lpass_macro *lpass_macro_pds_init(struct device *dev)
>   	struct lpass_macro *l_pds;
>   	int ret;
>   
> -	if (!of_find_property(dev->of_node, "power-domains", NULL))
> +	if (!of_property_present(dev->of_node, "power-domains"))
>   		return NULL;
>   
>   	l_pds = devm_kzalloc(dev, sizeof(*l_pds), GFP_KERNEL);
> diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
> index 5daa824a4ffc..d788f5f23a8a 100644
> --- a/sound/soc/generic/audio-graph-card.c
> +++ b/sound/soc/generic/audio-graph-card.c
> @@ -78,7 +78,7 @@ static int graph_get_dai_id(struct device_node *ep)
>   		 * only of_graph_parse_endpoint().
>   		 * We need to check "reg" property
>   		 */
> -		if (of_get_property(ep,   "reg", NULL))
> +		if (of_property_present(ep,   "reg"))

Bit of nit picking, but any reason, why there are multiple spaces, 
before "reg" here?

>   			return info.id;
>   
>   		node = of_get_parent(ep);
> diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c
> index 06609a526b78..259544f64df9 100644
> --- a/sound/soc/generic/audio-graph-card2.c
> +++ b/sound/soc/generic/audio-graph-card2.c
> @@ -376,7 +376,7 @@ static int graph_get_dai_id(struct device_node *ep)
>   		 * only of_graph_parse_endpoint().
>   		 * We need to check "reg" property
>   		 */
> -		if (of_get_property(ep,   "reg", NULL))
> +		if (of_property_present(ep,   "reg"))

And here?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ