From: Javier Martinez Canillas <javierm@redhat.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: kernel test robot <lkp@intel.com>,
llvm@lists.linux.dev, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table'
Date: Sun, 29 May 2022 09:34:04 +0200 [thread overview]
Message-ID: <0a3c11c7-2669-ca85-69d1-3b3faa2f7a3c@redhat.com> (raw)
In-Reply-To: <YpLF9jdqiub98Nl/@dev-arch.thelio-3990X>
Hello Nathan,
On 5/29/22 03:01, Nathan Chancellor wrote:
> On Sat, May 28, 2022 at 11:23:04PM +0200, Javier Martinez Canillas wrote:
>> Hello,
>>
>> On 5/28/22 22:58, kernel test robot wrote:
>>> Hi Javier,
>>>
>>> FYI, the error/warning still remains.
>>>
>>
>> Yes, but in my opinion is a false positive.
>
> I don't think it is a false positive for this particular configuration.
> MODULE_DEVICE_TABLE expands to nothing when the file it is included in
> is built into the kernel, as opposed to a module, so the variable truly
> is unused.
>
I know that is not used but my point is that we shouldn't need that table
in the first place. The only reason we add it is to workaround a bug in
the SPI core.
> $ curl -LSs https://download.01.org/0day-ci/archive/20220529/202205290422.eoxGqDMR-lkp@intel.com/config | rg CONFIG_DRM_SSD130X_SPI
> CONFIG_DRM_SSD130X_SPI=y
>
> You'll see the same warning with GCC and a similar configuration:
>
Yes, I'm not saying that the compiler warning is a false positive but
that the reported error for this driver is. Since the correct fix on
a driver that support SPI platform devices would be to use the table
and set it to the struct spi_driver .id field.
> drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: error: ‘ssd130x_spi_table’ defined but not used [-Werror=unused-const-variable=]
> 154 | static const struct spi_device_id ssd130x_spi_table[] = {
> | ^~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> At the end of the day, this warning only shows up under W=1, so take it
> as you will. The kernel test robot is a sign, not a cop :)
>
I guess something that could be done is to guard the definition of the
ssd130x_spi_table with a `if IS_MODULE(CONFIG_DRM_SSD130X_SPI)`, since
if the symbol is 'y' and the driver built-in, then won't be used indeed.
> Cheers,
> Nathan
>
--
Best regards,
Javier Martinez Canillas
Linux Engineering
Red Hat
next prev parent reply other threads:[~2022-05-29 7:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-28 20:58 drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table' kernel test robot
2022-05-28 21:23 ` Javier Martinez Canillas
2022-05-29 1:01 ` Nathan Chancellor
2022-05-29 7:34 ` Javier Martinez Canillas [this message]
2022-05-30 14:13 ` Javier Martinez Canillas
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=0a3c11c7-2669-ca85-69d1-3b3faa2f7a3c@redhat.com \
--to=javierm@redhat.com \
--cc=geert+renesas@glider.be \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=nathan@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;
as well as URLs for NNTP newsgroup(s).