lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 20 Sep 2019 09:45:44 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     Andy Gross <agross@...nel.org>, Arnd Bergmann <arnd@...db.de>,
        Jassi Brar <jassisinghbrar@...il.com>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Niklas Cassel <niklas.cassel@...aro.org>,
        Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@...aro.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Jassi Brar <jaswinder.singh@...aro.org>,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mbox: qcom: avoid unused-variable warning

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@...db.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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ