Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp193675pxy; Wed, 21 Apr 2021 23:12:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxstEWxcf9FDLzEdBOFxkGkP1zQQetO0H69WAIjoalpDkKai7QapMV6ZrqAPL25mGN3K2g0 X-Received: by 2002:aa7:c492:: with SMTP id m18mr1830833edq.30.1619071939496; Wed, 21 Apr 2021 23:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619071939; cv=none; d=google.com; s=arc-20160816; b=T2lon94QBoJMCvRSya2YfsWmocqs90rIHOaz4gXP+FvtQqJk8EdWYZy1tU5Oxuz7sG y1JyA9XsC6zIkCSE21IKRarEdcXAF9QCOzklWc8nN4ZFvbZ8PzJu62kMxXwcUERRbDcg +Qf8ZTFDfiE7eh9eKIh0+bcjSum82p7iPVNSSbsxUw6QpFYN7aR/RvZKE+a/Zw5vQzmS MnhNlQs3kg11h4peSpNRD7u2oVYtwwAA6P/XfH8nd+5/seiD2wMXidUNyF0u4Y7of3xb uKJFzIOQ5Wn1lp4j6XfPUeYYq58aFftdqxmejvmIsmk7VHg4juUqd2JJ5+Wjn5blA0OO 8iRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from; bh=vdNMG0d19GI345r5svTY0JId9qV976p1utgQk1tWfkI=; b=UcdI9S2PAVpHjmhWO1ZhNNL/AAPZ2sWMpNoEhSnc7H1DczsKUiBj2iUbE/koEMo3Z8 z2W/NJT7ax0oN7LiVP9siSGgL8Z2gMqamCfuVTYzjnZQY2Q3wzLwryNch19BDE9Sk53y eT7Fp7dGpsI2zfGRiz8tJ1IuK0+Vz3Uwe2nZfdhoyd03iVlS6Cu3HFsJKibbwpse8kmZ CY2Q5WjvjUGWsne0uJexq9QKsCxQnU/LfWjqDcNLh33hiMT93iy3q6xyuR1gsbUtcrtW sLDRF9vDApw4cIiTwK21UhxtoDbOB8Pb58EAMdgxlbck8GygsBDdb7Idk0j/avtwEczm lEuQ== 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=toshiba.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si1470090edw.194.2021.04.21.23.11.55; Wed, 21 Apr 2021 23:12:19 -0700 (PDT) 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=toshiba.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbhDVGLh (ORCPT + 99 others); Thu, 22 Apr 2021 02:11:37 -0400 Received: from mo-csw-fb1114.securemx.jp ([210.130.202.173]:33200 "EHLO mo-csw-fb.securemx.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbhDVGLg (ORCPT ); Thu, 22 Apr 2021 02:11:36 -0400 X-Greylist: delayed 1328 seconds by postgrey-1.27 at vger.kernel.org; Thu, 22 Apr 2021 02:11:35 EDT Received: by mo-csw-fb.securemx.jp (mx-mo-csw-fb1114) id 13M5msoh021284; Thu, 22 Apr 2021 14:48:54 +0900 Received: by mo-csw.securemx.jp (mx-mo-csw1115) id 13M5mOm8030458; Thu, 22 Apr 2021 14:48:24 +0900 X-Iguazu-Qid: 2wHHssSnbtZqBQQ742 X-Iguazu-QSIG: v=2; s=0; t=1619070503; q=2wHHssSnbtZqBQQ742; m=rx+BxJ6k7af4P5UpUKDCwEMfa8HZ5u9ma8Dnr+6Zn0I= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1110) id 13M5mKPu025052 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 22 Apr 2021 14:48:21 +0900 Received: from enc01.toshiba.co.jp (enc01.toshiba.co.jp [106.186.93.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by imx2-a.toshiba.co.jp (Postfix) with ESMTPS id BAFB2100117; Thu, 22 Apr 2021 14:48:20 +0900 (JST) Received: from hop001.toshiba.co.jp ([133.199.164.63]) by enc01.toshiba.co.jp with ESMTP id 13M5mKj2019193; Thu, 22 Apr 2021 14:48:20 +0900 From: Punit Agrawal To: Arnd Bergmann Cc: Michael Turquette , Stephen Boyd , Michal Simek , Arnd Bergmann , Rajan Vaja , Greg Kroah-Hartman , Jolly Shah , Quanyang Wang , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: zynqmp: fix compile testing without ZYNQMP_FIRMWARE References: <20210421134844.3297838-1-arnd@kernel.org> Date: Thu, 22 Apr 2021 14:48:18 +0900 In-Reply-To: <20210421134844.3297838-1-arnd@kernel.org> (Arnd Bergmann's message of "Wed, 21 Apr 2021 15:48:36 +0200") X-TSB-HOP: ON Message-ID: <871rb2swd9.fsf@kokedama.swc.toshiba.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, Thanks for the fix. Arnd Bergmann writes: > From: Arnd Bergmann > > When the firmware code is disabled, the incomplete error handling > in the clk driver causes compile-time warnings: > > drivers/clk/zynqmp/pll.c: In function 'zynqmp_pll_recalc_rate': > drivers/clk/zynqmp/pll.c:147:29: error: 'fbdiv' is used uninitialized [-Werror=uninitialized] > 147 | rate = parent_rate * fbdiv; > | ~~~~~~~~~~~~^~~~~~~ > In function 'zynqmp_pll_get_mode', > inlined from 'zynqmp_pll_recalc_rate' at drivers/clk/zynqmp/pll.c:148:6: > drivers/clk/zynqmp/pll.c:61:27: error: 'ret_payload' is used uninitialized [-Werror=uninitialized] > 61 | return ret_payload[1]; > | ~~~~~~~~~~~^~~ > drivers/clk/zynqmp/pll.c: In function 'zynqmp_pll_recalc_rate': > drivers/clk/zynqmp/pll.c:53:13: note: 'ret_payload' declared here > 53 | u32 ret_payload[PAYLOAD_ARG_CNT]; > | ^~~~~~~~~~~ > drivers/clk/zynqmp/clk-mux-zynqmp.c: In function 'zynqmp_clk_mux_get_parent': > drivers/clk/zynqmp/clk-mux-zynqmp.c:57:16: error: 'val' is used uninitialized [-Werror=uninitialized] > 57 | return val; > | ^~~ Not sure what I am missing but I couldn't reproduce these warnings. I tried a few different ways to toggle CONFIG_ZYNQMP_FIRMWARE. Regardless... > As it was apparently intentional to support this for compile testing > purposes, change the code to have just enough error handling for the > compiler to not notice the remaining bugs. > > Fixes: 21f237534661 ("clk: zynqmp: Drop dependency on ARCH_ZYNQMP") > Signed-off-by: Arnd Bergmann > --- > drivers/clk/zynqmp/clk-mux-zynqmp.c | 4 +++- > drivers/clk/zynqmp/pll.c | 8 ++++++-- > 2 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/clk/zynqmp/clk-mux-zynqmp.c b/drivers/clk/zynqmp/clk-mux-zynqmp.c > index 06194149be83..2afded3c7c11 100644 > --- a/drivers/clk/zynqmp/clk-mux-zynqmp.c > +++ b/drivers/clk/zynqmp/clk-mux-zynqmp.c > @@ -50,9 +50,11 @@ static u8 zynqmp_clk_mux_get_parent(struct clk_hw *hw) > > ret = zynqmp_pm_clock_getparent(clk_id, &val); > > - if (ret) > + if (ret) { > pr_warn_once("%s() getparent failed for clock: %s, ret = %d\n", > __func__, clk_name, ret); > + return ret; > + } > > return val; > } > diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c > index abe6afbf3407..67d2a2d260c1 100644 > --- a/drivers/clk/zynqmp/pll.c > +++ b/drivers/clk/zynqmp/pll.c > @@ -54,9 +54,11 @@ static inline enum pll_mode zynqmp_pll_get_mode(struct clk_hw *hw) > int ret; > > ret = zynqmp_pm_get_pll_frac_mode(clk_id, ret_payload); > - if (ret) > + if (ret) { > pr_warn_once("%s() PLL get frac mode failed for %s, ret = %d\n", > __func__, clk_name, ret); > + return ret; > + } > > return ret_payload[1]; > } > @@ -140,9 +142,11 @@ static unsigned long zynqmp_pll_recalc_rate(struct clk_hw *hw, > int ret; > > ret = zynqmp_pm_clock_getdivider(clk_id, &fbdiv); > - if (ret) > + if (ret) { > pr_warn_once("%s() get divider failed for %s, ret = %d\n", > __func__, clk_name, ret); > + return -1ul; > + } > > rate = parent_rate * fbdiv; > if (zynqmp_pll_get_mode(hw) == PLL_MODE_FRAC) { The changes make sense in that the functions error out sensibly when the zynqmp firmware driver is not enabled. Acked-by: Punit Agrawal Punit