From patchwork Thu May 12 18:45:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Edworthy X-Patchwork-Id: 12848037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B48CC433EF for ; Thu, 12 May 2022 18:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9EtYvmtqJh/06MTDQwfiH3wv02oZmsb+Onb5TThFtus=; b=hkU1R/Nxjkdw+e KMwFAifDgjBwhs8rF/t0SNFflO+0KrzidCPxDPyijNpY3NK8wRfCFxvAkYtyGEEy64bpqu38dvGU7 BqyDSWOvv02fGzKq7wlFgYz6VJRWkv50PC/ugrUzb+KM1tnpd0JTzHdgGw1jqkknEtDUG63niAVS+ r95RIMaADhH7/fE4ozZxeTprjCHSHlpI9pGY8IVcXn3u9ek7uZlsVj8PbPsvUlygmnu9XwaitTG4H 2w9De/hILcMP7d7yMN1bu/eFRhWJe2ydvaYTXkFAEZ69HfVuwSXpAW7m9JPIR/78pJDyNgpxrb7py ptNgUBURtwQ9cS1eTyIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1npDpE-00D8NI-Gj; Thu, 12 May 2022 18:46:12 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1npDpB-00D8Kw-BK; Thu, 12 May 2022 18:46:11 +0000 X-IronPort-AV: E=Sophos;i="5.91,220,1647270000"; d="scan'208";a="119513527" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 13 May 2022 03:46:04 +0900 Received: from localhost.localdomain (unknown [10.226.93.50]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id A141E400C737; Fri, 13 May 2022 03:46:01 +0900 (JST) From: Phil Edworthy To: Miquel Raynal , Vignesh Raghavendra , Heiko Stuebner Cc: Phil Edworthy , Richard Weinberger , Yihao Han , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH] mtd: rawnand: rockchip: Check before clk_disable_unprepare() not needed Date: Thu, 12 May 2022 19:45:58 +0100 Message-Id: <20220512184558.45966-1-phil.edworthy@renesas.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220512_114609_537521_2B0F32C6 X-CRM114-Status: GOOD ( 11.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org All code in clk_disable_unprepare() already checks the clk ptr using IS_ERR_OR_NULL so there is no need to check it again before calling it. A lot of other drivers already rely on this behaviour, so it's safe to do so here. Signed-off-by: Phil Edworthy --- Note: this has not been tested at all --- drivers/mtd/nand/raw/rockchip-nand-controller.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c index cbaa4f1c83da..f133985cc053 100644 --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c @@ -911,8 +911,7 @@ static int rk_nfc_enable_clks(struct device *dev, struct rk_nfc *nfc) ret = clk_prepare_enable(nfc->ahb_clk); if (ret) { dev_err(dev, "failed to enable ahb clk\n"); - if (!IS_ERR(nfc->nfc_clk)) - clk_disable_unprepare(nfc->nfc_clk); + clk_disable_unprepare(nfc->nfc_clk); return ret; } @@ -921,8 +920,7 @@ static int rk_nfc_enable_clks(struct device *dev, struct rk_nfc *nfc) static void rk_nfc_disable_clks(struct rk_nfc *nfc) { - if (!IS_ERR(nfc->nfc_clk)) - clk_disable_unprepare(nfc->nfc_clk); + clk_disable_unprepare(nfc->nfc_clk); clk_disable_unprepare(nfc->ahb_clk); }