Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5459152pxb; Wed, 26 Jan 2022 12:28:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmyy6wiCUysssnU2sX6Rl70oCZ5v4aQRjkZo7NNBrmIXc0DdDYhi61MnwQhVypDBRScbSY X-Received: by 2002:a17:90b:4c0d:: with SMTP id na13mr636370pjb.96.1643228899433; Wed, 26 Jan 2022 12:28:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643228899; cv=none; d=google.com; s=arc-20160816; b=uEn8x4g5xZ24P6Ivcce85IxM67AYq10o+qphLYIN1jukizYDs/1vGpcRiA1vm1++HP bJCcFc0F+Xf2ixRO7aMjw0EBERtGgN3FbiHNwMAZuEEJto1qHQkqcybdsRiqaO7RUAha 9/mwIfJcLTSDzWIWDqw2gatfbLDaT6k6mHMSHG3MLKzjJZzEaBysjG7tRDqEyf8LAh89 +j4gTpPsH1mNUG5+3+v6QSh6BpBqXUt6B1FVyPulobtyHB4yquz0ifSuehSo+buPuYth jQM5Fdd4wX4AxCTjMuMfah7d8f3SUAd8fQWfSmd2AIYSMm1xnpTiqg/GAbysKuWfaFzn ncYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=2gY3nNhzoCEWnRAYSB76f5I62CjCMVzQVPJVCGFKL/0=; b=siTTqekq53dIxWH8l9o8kxILw4ye1YzykCkUmSHIKx5n7AijDFX1pIuQJz4Jo/cZd2 uiuz2VHDpm9NFGut83cp5B4L1VYu1/cyPbRzWs7f4X9j06yFGJtk7rhwKyhNUjcznDsK 98VaTMH9ACKWFd5UdSYTBOOjjD3eyDX0MYFRR9TI7fMsLIGEkweOprR3ME8laVkEOWxG EJRLSXPkBqq9aZbibY5b6+rwDnBvmCQPUSeDH+jYLd3LzJ5iYCmn0rgJVSYkB1cnwFZ9 18tab4uyFXEAxp3UR16ttSQ0tyPKxxbZIk9u8ftEVD+/3Rjpz4nGfFRMut6jQKKCaJWP pSGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si224576pgc.103.2022.01.26.12.28.07; Wed, 26 Jan 2022 12:28:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238150AbiAZIIl (ORCPT + 99 others); Wed, 26 Jan 2022 03:08:41 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:43536 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S238131AbiAZIIk (ORCPT ); Wed, 26 Jan 2022 03:08:40 -0500 X-UUID: 4ca71b6cea074c898b00582c1f7c8774-20220126 X-UUID: 4ca71b6cea074c898b00582c1f7c8774-20220126 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2052481523; Wed, 26 Jan 2022 16:08:37 +0800 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 26 Jan 2022 16:08:36 +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 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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