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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1FEAC433B4 for ; Thu, 22 Apr 2021 06:11:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF1F161435 for ; Thu, 22 Apr 2021 06:11:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231656AbhDVGLi (ORCPT ); Thu, 22 Apr 2021 02:11:38 -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 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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B30A3C433B4 for ; Thu, 22 Apr 2021 05:51:12 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 165096144D for ; Thu, 22 Apr 2021 05:51:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 165096144D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-Reply-To:Date:References: 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=nW3MtnU/om/rK4YUF3CTEFZ+Blau4miGS0NxhPppPxA=; b=X2DtDhxumiQt6StdbW0cnM13r vHWjwyFinhghtmaxFOvMXj3qjORl84Pr9iPXG+fxGtfEt1/jcUCd2iF1WTeWHklftfrAZuP509nD8 JXXSoGCnR5X8Iebfo6pk2DlmBSajAxi4qJgyai6jVrdk5wvIB5ToVKAn4fXgkxGiSfSpHpWHtewp8 MXkUnUWAL/gcP0+zYUpgopyeDXnUD2Nmjas3hUqWU7JL97NFrHDkFeS242wsOXjT2JuGhpyVI/fi3 T86cS+O1/CgX4/gDij5s3DZRUy6PUj8+NfNGVOoD1CZtEFSvkY6QOTS65Xl6wrf/BFIvIadVcIlvc 55hToNpoA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZSCw-00FwDx-AA; Thu, 22 Apr 2021 05:48:58 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZSCs-00FwDh-Kv for linux-arm-kernel@desiato.infradead.org; Thu, 22 Apr 2021 05:48:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=vdNMG0d19GI345r5svTY0JId9qV976p1utgQk1tWfkI=; b=cOVgcjd6bxacIklhsZwSLNnNnM g/4yoyn+2KOqtpakWxLPGvT+iVMh9RJl6oZVQNX6HJFd6zjH3FdveEjt1/ZncJ4aJB9+mtxY2ouz0 tyiS+xtthAyhkqptrkfMd31IuBKIOIGj099HZL7bm4XM3OtWwSzF8YfiG2By0duq1v5A1WaIAvO0Y sDJGieYph1SKaZzAd+ijS5XwXZE3swbR3hkv96cEjHh5e41phLhv6CupvitrbULcfhPUmgMvSgQ88 TaaUZVXR5SeTRqw3vqBim7B8CwR97UPnepoZNJA1/ZZGDRleUFyrGRIwRbURyJ4xTogANI9VlS9R/ TxHI/JiQ==; Received: from mo-csw1115.securemx.jp ([210.130.202.157] helo=mo-csw.securemx.jp) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZSCo-00DOLT-8e for linux-arm-kernel@lists.infradead.org; Thu, 22 Apr 2021 05:48:52 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210421_224850_622798_DDC72BBB X-CRM114-Status: GOOD ( 27.28 ) 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel