devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: "Lothar Waßmann" <LW@KARO-electronics.de>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Fabio Estevam" <fabio.estevam@freescale.com>,
	"Greg Ungerer" <gerg@uclinux.org>,
	"Kevin Hao" <haokexin@gmail.com>,
	"Nimrod Andy" <B38611@freescale.com>,
	"Philippe Reynes" <tremyfr@gmail.com>,
	"Richard Cochran" <richardcochran@gmail.com>,
	"Russell King" <rmk+kernel@arm.linux.org.uk>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Stefan Agner" <stefan@agner.ch>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	"Jeff Kirsher" <jeffrey.t.kirsher@intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
	"Kumar Gala" <galak@codeaurora.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Russell King" <linux@arm.linux.org.uk>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Shawn Guo" <shawnguo@kernel.org>
Subject: Re: [PATCHv2 1/2] remove redundant struct clk NULL checks
Date: Tue, 12 Jan 2016 16:25:58 +0100	[thread overview]
Message-ID: <1452612358.3694.44.camel@pengutronix.de> (raw)
In-Reply-To: <1452611876-451-2-git-send-email-LW@KARO-electronics.de>

Am Dienstag, den 12.01.2016, 16:17 +0100 schrieb Lothar Waßmann:
> NULL is a valid argument to clk_enable()/clk_disable(). Remove
> redundant checks before calling those functions.
> 
> Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
>  drivers/net/ethernet/freescale/fec_main.c | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 502da6f..592a7a4 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1874,35 +1874,30 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
>  			}
>  			mutex_unlock(&fep->ptp_clk_mutex);
>  		}
> -		if (fep->clk_ref) {
> -			ret = clk_prepare_enable(fep->clk_ref);
> -			if (ret)
> -				goto failed_clk_ref;
> -		}
> +
> +		ret = clk_prepare_enable(fep->clk_ref);
> +		if (ret)
> +			goto failed_clk_ref;
>  	} else {
>  		clk_disable_unprepare(fep->clk_ahb);
> -		if (fep->clk_enet_out)
> -			clk_disable_unprepare(fep->clk_enet_out);
> +		clk_disable_unprepare(fep->clk_enet_out);
>  		if (fep->clk_ptp) {
>  			mutex_lock(&fep->ptp_clk_mutex);
>  			clk_disable_unprepare(fep->clk_ptp);
>  			fep->ptp_clk_on = false;
>  			mutex_unlock(&fep->ptp_clk_mutex);
>  		}
> -		if (fep->clk_ref)
> -			clk_disable_unprepare(fep->clk_ref);
> +		clk_disable_unprepare(fep->clk_ref);
>  	}
>  
>  	return 0;
>  
>  failed_clk_ref:
> -	if (fep->clk_ref)
> -		clk_disable_unprepare(fep->clk_ref);
> +	clk_disable_unprepare(fep->clk_ref);
>  failed_clk_ptp:
> -	if (fep->clk_enet_out)
> -		clk_disable_unprepare(fep->clk_enet_out);
> +	clk_disable_unprepare(fep->clk_enet_out);
>  failed_clk_enet_out:
> -		clk_disable_unprepare(fep->clk_ahb);
> +	clk_disable_unprepare(fep->clk_ahb);
>  
>  	return ret;
>  }

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |

  parent reply	other threads:[~2016-01-12 15:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 15:17 [PATCHv2 0/2] net: fec: Reset ethernet PHY whenever the enet_out clock is being enabled Lothar Waßmann
2016-01-12 15:17 ` [PATCHv2 1/2] remove redundant struct clk NULL checks Lothar Waßmann
     [not found]   ` <1452611876-451-2-git-send-email-LW-bxm8fMRDkQLDiMYJYoSAnRvVK+yQ3ZXh@public.gmane.org>
2016-01-12 15:17     ` [PATCHv2 2/2] net: fec: Reset ethernet PHY whenever the enet_out clock is being enabled Lothar Waßmann
2016-01-12 15:17   ` Lothar Waßmann
2016-01-12 15:28     ` Lucas Stach
2016-01-12 15:25   ` Lucas Stach [this message]
     [not found] ` <1452611876-451-1-git-send-email-LW-bxm8fMRDkQLDiMYJYoSAnRvVK+yQ3ZXh@public.gmane.org>
2016-01-12 15:17   ` [PATCHv2 1/2] remove redundant struct clk NULL checks Lothar Waßmann
2016-01-12 15:24 ` [PATCHv2 0/2] net: fec: Reset ethernet PHY whenever the enet_out clock is being enabled Russell King - ARM Linux
2016-01-12 16:04   ` Lothar Waßmann
2016-01-12 20:30     ` Uwe Kleine-König
2016-09-26 15:37       ` Jörg Krause

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452612358.3694.44.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=B38611@freescale.com \
    --cc=LW@KARO-electronics.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=fabio.estevam@freescale.com \
    --cc=galak@codeaurora.org \
    --cc=gerg@uclinux.org \
    --cc=haokexin@gmail.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=richardcochran@gmail.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    --cc=tremyfr@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).