All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Andy Gross <agross@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Jassi Brar <jassisinghbrar@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Niklas Cassel <niklas.cassel@linaro.org>,
	Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Jassi Brar <jaswinder.singh@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mbox: qcom: avoid unused-variable warning
Date: Fri, 20 Sep 2019 09:45:44 -0700	[thread overview]
Message-ID: <20190920164545.68FFB20717@mail.kernel.org> (raw)
In-Reply-To: <20190920145543.1732316-1-arnd@arndb.de>

Quoting Arnd Bergmann (2019-09-20 07:55:29)
> Without CONFIG_OF, there is no reference to the apcs_clk_match_table[]
> array, causing a harmless warning:
> 
> drivers/mailbox/qcom-apcs-ipc-mailbox.c:57:28: error: unused variable 'apcs_clk_match_table' [-Werror,-Wunused-variable]
>         const struct of_device_id apcs_clk_match_table[] = {
> 
> Move the variable out of the variable scope and mark it 'static'
> to avoid the warning (static const variables get silently dropped
> by the compiler), and avoid the on-stack copy at the same time.
> 
> Fixes: 78c86458a440 ("mbox: qcom: add APCS child device for QCS404")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/mailbox/qcom-apcs-ipc-mailbox.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
> index eeebafd546e5..10557a950c2d 100644
> --- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c
> +++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
> @@ -45,6 +45,12 @@ static const struct mbox_chan_ops qcom_apcs_ipc_ops = {
>         .send_data = qcom_apcs_ipc_send_data,
>  };
>  
> +static const struct of_device_id apcs_clk_match_table[] = {
> +       { .compatible = "qcom,msm8916-apcs-kpss-global", },
> +       { .compatible = "qcom,qcs404-apcs-apps-global", },
> +       {}
> +};
> +
>  static int qcom_apcs_ipc_probe(struct platform_device *pdev)
>  {
>         struct qcom_apcs_ipc *apcs;
> @@ -54,11 +60,6 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
>         void __iomem *base;
>         unsigned long i;
>         int ret;
> -       const struct of_device_id apcs_clk_match_table[] = {

Does marking it static here work too? It would be nice to limit the
scope of this variable to this function instead of making it a global.
Also, it might be slightly smaller code size if that works.

> -               { .compatible = "qcom,msm8916-apcs-kpss-global", },
> -               { .compatible = "qcom,qcs404-apcs-apps-global", },
> -               {}
> -       };
>  
>         apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL);
>         if (!apcs)

  reply	other threads:[~2019-09-20 16:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 14:55 [PATCH] mbox: qcom: avoid unused-variable warning Arnd Bergmann
2019-09-20 16:45 ` Stephen Boyd [this message]
2019-09-20 19:27   ` Arnd Bergmann
     [not found]     ` <20190920210622.51382205F4@mail.kernel.org>
2019-09-26 13:07       ` Geert Uytterhoeven
2019-09-27 18:26         ` Stephen Boyd
2019-09-27 19:10           ` Geert Uytterhoeven
2019-10-03 21:16             ` Stephen Boyd

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=20190920164545.68FFB20717@mail.kernel.org \
    --to=sboyd@kernel.org \
    --cc=agross@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=jorge.ramirez-ortiz@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=niklas.cassel@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 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.