From mboxrd@z Thu Jan 1 00:00:00 1970 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 6E4C8C2BA4C for ; Wed, 26 Jan 2022 08:20:18 +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:References:In-Reply-To: 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: List-Owner; bh=3FkdNd9LfcOJKW2jL+gDngV8KjctPsJhuiBk0B7jGUE=; b=1Cd67sqGcag3uW Mm4gCoJQgP5Fkik8rA+ShG+Hwmdfiq97xD4ClbIhSsGm9VlSMvwIPibptA8DnVW+iw4gwvQCc1nTe w0OUd9RoBO1NkU9KeBQunbLAu5pykPgDDR/vM0eFHXF5GtxxLj/nGH8MvBYt2E9Tj00nopS4vpeNf n7D013zaSuTCmnYJM3Fq7IhMk/Hi8lR8MpjJsod3RWzRIRLHWSTwGO68rnWY5zGGL5U/RaFeE4MTy OQ9fFU4qJEv+crfklbN1U5iwrq6x4Z+hIAEy2jANp+U1SWGlk0PVQNwSATA+ainik92LnkCtb9tCM OJ5W0hadUIs1c1vEmW3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCdWD-00AgFn-RS; Wed, 26 Jan 2022 08:19:06 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCdVw-00AgAv-8I; Wed, 26 Jan 2022 08:18:49 +0000 X-UUID: 5eddeb59a63e4820b7d08df15355be73-20220126 X-UUID: 5eddeb59a63e4820b7d08df15355be73-20220126 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1727298200; Wed, 26 Jan 2022 01:18:46 -0700 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 26 Jan 2022 00:08:44 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 26 Jan 2022 16:08:36 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 26 Jan 2022 16:08:36 +0800 From: Miles Chen To: CC: , , , , , , , Subject: Re: [PATCH 23/31] clk: mediatek: mux: Reverse check for existing clk to reduce nesting level Date: Wed, 26 Jan 2022 16:08:36 +0800 Message-ID: <20220126080836.1148-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220122091731.283592-24-wenst@chromium.org> References: <20220122091731.283592-24-wenst@chromium.org> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220126_001848_346477_58307605 X-CRM114-Status: GOOD ( 18.95 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > The clk registration code here currently does: > > if (IS_ERR_OR_NULL(clk_data->clks[mux->id])) { > ... do clk registration ... > } > > This extra level of nesting wastes screen real estate. > > Reduce the nesting level by reversing the conditional shown above. > Other than that, functionality is not changed. > > > Signed-off-by: Chen-Yu Tsai Reviewed-by: Miles Chen > --- > drivers/clk/mediatek/clk-mux.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > Diff --git a/drivers/clk/mediatek/clk-mux.c b/drivers/clk/mediatek/clk-mux.c > Index 01af6a52711a..70aa42144632 100644 > --- a/drivers/clk/mediatek/clk-mux.c > +++ b/drivers/clk/mediatek/clk-mux.c > @@ -208,16 +208,17 @@ int mtk_clk_register_muxes(const struct mtk_mux *muxes, > for (i = 0; i < num; i++) { > const struct mtk_mux *mux = &muxes[i]; > > - if (IS_ERR_OR_NULL(clk_data->clks[mux->id])) { > - clk = mtk_clk_register_mux(mux, regmap, lock); > + if (!IS_ERR_OR_NULL(clk_data->clks[mux->id])) > + continue; > > - if (IS_ERR(clk)) { > - pr_err("Failed to register clk %s: %pe\n", mux->name, clk); > - continue; > - } > + clk = mtk_clk_register_mux(mux, regmap, lock); > > - clk_data->clks[mux->id] = clk; > + if (IS_ERR(clk)) { > + pr_err("Failed to register clk %s: %pe\n", mux->name, clk); > + continue; > } > + > + clk_data->clks[mux->id] = clk; > } > > return 0; > -- > 2.35.0.rc0.227.g00780c9af4-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel