From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andy Gross <andy.gross@linaro.org>,
David Brown <david.brown@linaro.org>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Evan Green <evgreen@chromium.org>,
Karthikeyan Ramasubramanian <kramasub@codeaurora.org>,
Mahesh Sivasubramanian <msivasub@codeaurora.org>,
linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] qcom: cmd-db: enforce CONFIG_OF_RESERVED_MEM dependency
Date: Fri, 25 May 2018 21:20:20 -0700 [thread overview]
Message-ID: <20180526042020.GA2259@tuxbook-pro> (raw)
In-Reply-To: <20180525160836.125531-1-arnd@arndb.de>
On Fri 25 May 09:08 PDT 2018, Arnd Bergmann wrote:
> Without CONFIG_OF_RESERVED_MEM, gcc sees that the global cmd_db_header
> variable is never initialized, and through code optimization concludes
> that a lot of other code cannot possibly work after that:
>
> drivers/soc/qcom/cmd-db.c: In function 'cmd_db_read_addr':
> drivers/soc/qcom/cmd-db.c:197:21: error: 'ent.addr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> return ret < 0 ? 0 : le32_to_cpu(ent.addr);
> drivers/soc/qcom/cmd-db.c: In function 'cmd_db_read_aux_data':
> drivers/soc/qcom/cmd-db.c:224:10: error: 'ent.len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> ent_len = le16_to_cpu(ent.len);
> drivers/soc/qcom/cmd-db.c:115:6: error: 'rsc_hdr.data_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> u16 offset = le16_to_cpu(hdr->data_offset);
> ^~~~~~
> drivers/soc/qcom/cmd-db.c:116:6: error: 'ent.offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> u16 loffset = le16_to_cpu(ent->offset);
> ^~~~~~~
> drivers/soc/qcom/cmd-db.c: In function 'cmd_db_read_aux_data_len':
> drivers/soc/qcom/cmd-db.c:250:38: error: 'ent.len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> return ret < 0 ? 0 : le16_to_cpu(ent.len);
> ^
> drivers/soc/qcom/cmd-db.c: In function 'cmd_db_read_slave_id':
> drivers/soc/qcom/cmd-db.c:272:7: error: 'ent.addr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> Using a hard CONFIG_OF_RESERVED_MEM dependency avoids this warning,
> and we can remove the CONFIG_OF dependency.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> ---
> drivers/soc/qcom/Kconfig | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
> index 9dc02f390ba3..5856e792d09c 100644
> --- a/drivers/soc/qcom/Kconfig
> +++ b/drivers/soc/qcom/Kconfig
> @@ -5,7 +5,8 @@ menu "Qualcomm SoC drivers"
>
> config QCOM_COMMAND_DB
> bool "Qualcomm Command DB"
> - depends on (ARCH_QCOM && OF) || COMPILE_TEST
> + depends on ARCH_QCOM || COMPILE_TEST
> + depends on OF_RESERVED_MEM
> help
> Command DB queries shared memory by key string for shared system
> resources. Platform drivers that require to set state of a shared
> --
> 2.9.0
>
prev parent reply other threads:[~2018-05-26 4:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-25 16:08 [PATCH] qcom: cmd-db: enforce CONFIG_OF_RESERVED_MEM dependency Arnd Bergmann
2018-05-26 4:20 ` Bjorn Andersson [this message]
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=20180526042020.GA2259@tuxbook-pro \
--to=bjorn.andersson@linaro.org \
--cc=andy.gross@linaro.org \
--cc=arnd@arndb.de \
--cc=david.brown@linaro.org \
--cc=evgreen@chromium.org \
--cc=kramasub@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=msivasub@codeaurora.org \
--cc=srinivas.kandagatla@linaro.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;
as well as URLs for NNTP newsgroup(s).