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: <alpine.DEB.2.02.1408072148400.2043@localhost6.localdomain6>
Date:	Thu, 7 Aug 2014 21:49:22 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
cc:	netdev@...r.kernel.org,
	Claudiu Manoil <claudiu.manoil@...escale.com>,
	kernel@...gutronix.de, Florian Fainelli <f.fainelli@...il.com>,
	Fabio Estevam <fabio.estevam@...escale.com>
Subject: Re: [PATCH] net: gianfar: no need to check parameter being != NULL
 for of_node_put

On Thu, 7 Aug 2014, Uwe Kleine-König wrote:

> of_node_put is a noop when being called with NULL.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> ---
> Hello,
> 
> @Julia: I'm sure it's easy to create a coccinelle rule for this.

@@
expression e;
@@

-if (e)
   of_node_put(e);

It matches in 25 files.

julia

> 
> Best regards
> Uwe
> 
>  drivers/net/ethernet/freescale/gianfar.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
> index a6cf40e62f3a..6b0c4775cd0d 100644
> --- a/drivers/net/ethernet/freescale/gianfar.c
> +++ b/drivers/net/ethernet/freescale/gianfar.c
> @@ -1435,10 +1435,8 @@ register_fail:
>  	unmap_group_regs(priv);
>  	gfar_free_rx_queues(priv);
>  	gfar_free_tx_queues(priv);
> -	if (priv->phy_node)
> -		of_node_put(priv->phy_node);
> -	if (priv->tbi_node)
> -		of_node_put(priv->tbi_node);
> +	of_node_put(priv->phy_node);
> +	of_node_put(priv->tbi_node);
>  	free_gfar_dev(priv);
>  	return err;
>  }
> @@ -1447,10 +1445,8 @@ static int gfar_remove(struct platform_device *ofdev)
>  {
>  	struct gfar_private *priv = platform_get_drvdata(ofdev);
>  
> -	if (priv->phy_node)
> -		of_node_put(priv->phy_node);
> -	if (priv->tbi_node)
> -		of_node_put(priv->tbi_node);
> +	of_node_put(priv->phy_node);
> +	of_node_put(priv->tbi_node);
>  
>  	unregister_netdev(priv->ndev);
>  	unmap_group_regs(priv);
> -- 
> 2.0.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ