Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753766AbbK3Ldd (ORCPT ); Mon, 30 Nov 2015 06:33:33 -0500 Received: from mail.karo-electronics.de ([81.173.242.67]:60624 "EHLO mail.karo-electronics.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752562AbbK3Lda (ORCPT ); Mon, 30 Nov 2015 06:33:30 -0500 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= To: Andrew Lunn , "David S. Miller" , Fabio Estevam , Greg Ungerer , Kevin Hao , =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= , Lucas Stach , Nimrod Andy , Philippe Reynes , Richard Cochran , Russell King , Sascha Hauer , Stefan Agner , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Jeff Kirsher , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCH 1/3] net: fec: Remove redundant checks for NULL clk pointer Date: Mon, 30 Nov 2015 12:32:46 +0100 Message-Id: <1448883168-30742-2-git-send-email-LW@KARO-electronics.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448883168-30742-1-git-send-email-LW@KARO-electronics.de> References: <1448883168-30742-1-git-send-email-LW@KARO-electronics.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1944 Lines: 65 NULL is a valid argument to clk_enable()/clk_disable(). Remove redundant checks before calling those functions. Signed-off-by: Lothar Waßmann --- 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 d2328fc..e17d74f 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1873,35 +1873,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; } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/