From: Punit Agrawal <punit1.agrawal@toshiba.co.jp> To: Arnd Bergmann <arnd@kernel.org> Cc: Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Michal Simek <michal.simek@xilinx.com>, Arnd Bergmann <arnd@arndb.de>, Rajan Vaja <rajan.vaja@xilinx.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jolly Shah <jolly.shah@xilinx.com>, Quanyang Wang <quanyang.wang@windriver.com>, 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 Date: Thu, 22 Apr 2021 14:48:18 +0900 [thread overview] Message-ID: <871rb2swd9.fsf@kokedama.swc.toshiba.co.jp> (raw) In-Reply-To: <20210421134844.3297838-1-arnd@kernel.org> (Arnd Bergmann's message of "Wed, 21 Apr 2021 15:48:36 +0200") Hi Arnd, Thanks for the fix. Arnd Bergmann <arnd@kernel.org> writes: > From: Arnd Bergmann <arnd@arndb.de> > > 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 <arnd@arndb.de> > --- > 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 <punit1.agrawal@toshiba.co.jp> Punit
WARNING: multiple messages have this Message-ID (diff)
From: Punit Agrawal <punit1.agrawal@toshiba.co.jp> To: Arnd Bergmann <arnd@kernel.org> Cc: Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Michal Simek <michal.simek@xilinx.com>, Arnd Bergmann <arnd@arndb.de>, Rajan Vaja <rajan.vaja@xilinx.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jolly Shah <jolly.shah@xilinx.com>, Quanyang Wang <quanyang.wang@windriver.com>, 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 Date: Thu, 22 Apr 2021 14:48:18 +0900 [thread overview] Message-ID: <871rb2swd9.fsf@kokedama.swc.toshiba.co.jp> (raw) In-Reply-To: <20210421134844.3297838-1-arnd@kernel.org> (Arnd Bergmann's message of "Wed, 21 Apr 2021 15:48:36 +0200") Hi Arnd, Thanks for the fix. Arnd Bergmann <arnd@kernel.org> writes: > From: Arnd Bergmann <arnd@arndb.de> > > 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 <arnd@arndb.de> > --- > 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 <punit1.agrawal@toshiba.co.jp> Punit _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-04-22 6:11 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-21 13:48 [PATCH] clk: zynqmp: fix compile testing without ZYNQMP_FIRMWARE Arnd Bergmann 2021-04-21 13:48 ` Arnd Bergmann 2021-04-22 5:48 ` Punit Agrawal [this message] 2021-04-22 5:48 ` Punit Agrawal 2021-04-22 10:54 ` Michal Simek 2021-04-22 10:54 ` Michal Simek 2021-04-23 6:37 ` Punit Agrawal 2021-04-23 6:37 ` Punit Agrawal 2021-04-30 2:17 ` Stephen Boyd 2021-04-30 2:17 ` Stephen Boyd 2021-06-21 13:15 ` Michal Simek 2021-06-21 13:15 ` Michal Simek
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=871rb2swd9.fsf@kokedama.swc.toshiba.co.jp \ --to=punit1.agrawal@toshiba.co.jp \ --cc=arnd@arndb.de \ --cc=arnd@kernel.org \ --cc=gregkh@linuxfoundation.org \ --cc=jolly.shah@xilinx.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=michal.simek@xilinx.com \ --cc=mturquette@baylibre.com \ --cc=quanyang.wang@windriver.com \ --cc=rajan.vaja@xilinx.com \ --cc=sboyd@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.