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: <ZAxrBtNdou28yPPB@corigine.com>
Date:   Sat, 11 Mar 2023 12:50:30 +0100
From:   Simon Horman <simon.horman@...igine.com>
To:     Rob Herring <robh@...nel.org>
Cc:     Wolfgang Grandegger <wg@...ndegger.com>,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Claudiu Beznea <claudiu.beznea@...rochip.com>,
        Wei Fang <wei.fang@....com>,
        Shenwei Wang <shenwei.wang@....com>,
        Clark Wang <xiaoning.wang@....com>,
        NXP Linux Team <linux-imx@....com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Giuseppe Cavallaro <peppe.cavallaro@...com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        Jose Abreu <joabreu@...opsys.com>,
        Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Grygorii Strashko <grygorii.strashko@...com>,
        Francois Romieu <romieu@...zoreil.com>,
        Michal Simek <michal.simek@...inx.com>,
        Zhao Qiang <qiang.zhao@....com>, Kalle Valo <kvalo@...nel.org>,
        Samuel Mendoza-Jonas <sam@...dozajonas.com>,
        devicetree@...r.kernel.org, linux-can@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, linux-omap@...r.kernel.org,
        linuxppc-dev@...ts.ozlabs.org, linux-wireless@...r.kernel.org
Subject: Re: [PATCH] net: Use of_property_read_bool() for boolean properties

On Fri, Mar 10, 2023 at 08:47:16AM -0600, 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.
> Convert reading boolean properties to to of_property_read_bool().
> 
> Signed-off-by: Rob Herring <robh@...nel.org>

Reviewed-by: Simon Horman <simon.horman@...igine.com>

...

> diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
> index a502812ac418..86f7843b4591 100644
> --- a/drivers/net/ethernet/via/via-velocity.c
> +++ b/drivers/net/ethernet/via/via-velocity.c
> @@ -2709,8 +2709,7 @@ static int velocity_get_platform_info(struct velocity_info *vptr)
>  	struct resource res;
>  	int ret;
>  
> -	if (of_get_property(vptr->dev->of_node, "no-eeprom", NULL))
> -		vptr->no_eeprom = 1;
> +	vptr->no_eeprom = of_property_read_bool(vptr->dev->of_node, "no-eeprom");

As per my comment on "[PATCH] nfc: mrvl: Use of_property_read_bool() for
boolean properties".

I'm not that enthusiastic about assigning a bool value to a field
with an integer type. But that is likely a topic for another patch.

>  	ret = of_address_to_resource(vptr->dev->of_node, 0, &res);
>  	if (ret) {

...

> diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
> index 1c53b5546927..47c2ad7a3e42 100644
> --- a/drivers/net/wan/fsl_ucc_hdlc.c
> +++ b/drivers/net/wan/fsl_ucc_hdlc.c
> @@ -1177,14 +1177,9 @@ static int ucc_hdlc_probe(struct platform_device *pdev)
>  	uhdlc_priv->dev = &pdev->dev;
>  	uhdlc_priv->ut_info = ut_info;
>  
> -	if (of_get_property(np, "fsl,tdm-interface", NULL))
> -		uhdlc_priv->tsa = 1;
> -
> -	if (of_get_property(np, "fsl,ucc-internal-loopback", NULL))
> -		uhdlc_priv->loopback = 1;
> -
> -	if (of_get_property(np, "fsl,hdlc-bus", NULL))
> -		uhdlc_priv->hdlc_bus = 1;
> +	uhdlc_priv->tsa = of_property_read_bool(np, "fsl,tdm-interface");

Here too.

> +	uhdlc_priv->loopback = of_property_read_bool(np, "fsl,ucc-internal-loopback");
> +	uhdlc_priv->hdlc_bus = of_property_read_bool(np, "fsl,hdlc-bus");
>  
>  	if (uhdlc_priv->tsa == 1) {
>  		utdm = kzalloc(sizeof(*utdm), GFP_KERNEL);

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ