From: Michal Simek <michal.simek@xilinx.com>
To: Arnd Bergmann <arnd@arndb.de>, Michal Simek <michal.simek@xilinx.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Michal Simek <monstr@monstr.eu>, git <git@xilinx.com>,
Michael Turquette <mturquette@baylibre.com>,
Punit Agrawal <punit1.agrawal@toshiba.co.jp>,
Quanyang Wang <quanyang.wang@windriver.com>,
Stephen Boyd <sboyd@kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
linux-clk <linux-clk@vger.kernel.org>
Subject: Re: [PATCH v2] clk: zynqmp: fix compile testing without ZYNQMP_FIRMWARE
Date: Mon, 21 Jun 2021 15:54:44 +0200 [thread overview]
Message-ID: <6ef72766-74c3-8356-555b-818e887518a6@xilinx.com> (raw)
In-Reply-To: <CAK8P3a1twOhC8DFxpLxpk8bcy0+JfGZUSE9bX4tdMetVLGTcSQ@mail.gmail.com>
On 6/21/21 3:51 PM, Arnd Bergmann wrote:
> On Mon, Jun 21, 2021 at 3:14 PM Michal Simek <michal.simek@xilinx.com> wrote:
>>
>> 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;
>> | ^~~
>>
>> 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>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> Changes in v2:
>> Based on discussion here
>> Link: https://lore.kernel.org/r/20210421134844.3297838-1-arnd@kernel.org
>> I have updated error return value which I got from clock core based on
>> error cases.
>>
>> zynqmp_clk_mux_get_parent() should return num_parents() as error defined in
>> clk_core_get_parent_by_index() where num_parents is incorrect index.
>>
>> Extend zynqmp_pll_get_mode() with PLL_MODE_ERROR to handle error case.
>>
>> zynqmp_pll_recalc_rate() returns 0 because __clk_core_init() consider 0 as
>> default rate. But maybe -1ul which was used by Arnd is also good option.
>
> Looks good to me. You changed more than I did now, so it might be better
> to change my authorship to Co-developed-by, probably not worth respinning
> for that.
Let's see what Stephen said about these changes.
Thanks,
Michal
next prev parent reply other threads:[~2021-06-21 13:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 13:13 Michal Simek
2021-06-21 13:51 ` Arnd Bergmann
2021-06-21 13:54 ` Michal Simek [this message]
2021-06-22 7:12 ` quanyang.wang
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=6ef72766-74c3-8356-555b-818e887518a6@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=arnd@arndb.de \
--cc=git@xilinx.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=monstr@monstr.eu \
--cc=mturquette@baylibre.com \
--cc=punit1.agrawal@toshiba.co.jp \
--cc=quanyang.wang@windriver.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®