From: Su Hui <suhui@nfschina.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: jagathjog1996@gmail.com, jic23@kernel.org, lars@metafoo.de,
nathan@kernel.org, ndesaulniers@google.com, morbo@google.com,
justinstitt@google.com, benato.denis96@gmail.com,
Jonathan.Cameron@huawei.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] iio: bmi323: mark bmi323_ext_reg_savestate as maybe unused
Date: Sat, 12 Oct 2024 18:21:46 +0800 [thread overview]
Message-ID: <a39002c0-923d-9c9d-6d42-ea6e4b9ec153@nfschina.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2410121110540.8471@hadrien>
On 2024/10/12 17:11, Julia Lawall wrote:
> On Sat, 12 Oct 2024, Su Hui wrote:
>
>> When running 'make CC=clang drivers/iio/imu/bmi323/bmi323_core.o', there
>> is a clang warning as follows:
>>
>> drivers/iio/imu/bmi323/bmi323_core.c:133:27: error:
>> variable 'bmi323_ext_reg_savestate' is not needed and will not be emitted
>> [-Werror,-Wunneeded-internal-declaration]
>> 133 | static const unsigned int bmi323_ext_reg_savestate[] = {
>> | ^~~~~~~~~~~~~~~~~~~~~~~~
>> 1 error generated.
>>
>> Mark bmi323_ext_reg_savestate as __maybe_unused to silent this warning.
> Why might it be unused?
We only use the size of 'bmi323_ext_reg_savestate[]' not it's value, as
shown below :
$ git grep bmi323_ext_reg_savest drivers/iio/imu/
drivers/iio/imu/bmi323/bmi323_core.c:static const unsigned int
bmi323_ext_reg_savestate[] = {
drivers/iio/imu/bmi323/bmi323_core.c: unsigned int
ext_reg_settings[ARRAY_SIZE(bmi323_ext_reg_savestate)];
drivers/iio/imu/bmi323/bmi323_core.c: for (unsigned int i = 0; i <
ARRAY_SIZE(bmi323_ext_reg_savestate); i++) {
drivers/iio/imu/bmi323/bmi323_core.c: for (unsigned int i = 0; i <
ARRAY_SIZE(bmi323_ext_reg_savestate); i++) {
And I find some solutions use __maybe_unused to silent this warning.
Like this one:
3034983db355 ("drm/amdgpu: Mark mmhub_v1_8_mmea_err_status_reg as
__maybe_unused")
Mark this variable to __maybe_unused is to eliminate clang's warning.
Perhaps it is also possible to mark it as _used:).
Su Hui
prev parent reply other threads:[~2024-10-12 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 8:37 Su Hui
2024-10-12 9:11 ` Julia Lawall
2024-10-12 10:08 ` Javier Carrasco
2024-10-12 10:26 ` Su Hui
2024-10-12 10:51 ` Jonathan Cameron
2024-10-12 10:21 ` Su Hui [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=a39002c0-923d-9c9d-6d42-ea6e4b9ec153@nfschina.com \
--to=suhui@nfschina.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=benato.denis96@gmail.com \
--cc=jagathjog1996@gmail.com \
--cc=jic23@kernel.org \
--cc=julia.lawall@inria.fr \
--cc=justinstitt@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
/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®