linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Michal Kubecek <mkubecek@suse.cz>
Cc: netdev@vger.kernel.org,
	Nathan Chancellor <natechancellor@gmail.com>,
	Sasha Neftin <sasha.neftin@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	Aaron Brown <aaron.f.brown@intel.com>,
	intel-wired-lan@lists.osuosl.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Clang warning in drivers/net/ethernet/intel/igc/igc_ethtool.c
Date: Fri, 1 Mar 2019 10:28:35 -0800	[thread overview]
Message-ID: <CAKwvOdkNv_HUREJhUdOgHBgmVghPvJUun5wYuknCfTO0zN5TAg@mail.gmail.com> (raw)
In-Reply-To: <20190208143403.GD7035@unicorn.suse.cz>

On Fri, Feb 8, 2019 at 6:34 AM Michal Kubecek <mkubecek@suse.cz> wrote:
>
> On Thu, Feb 07, 2019 at 10:09:21PM -0700, Nathan Chancellor wrote:
> > Hi all,
> >
> > After commit 8c5ad0dae93c ("igc: Add ethtool support"), Clang warns:
> >
> > drivers/net/ethernet/intel/igc/igc_ethtool.c:9:19: warning: variable 'igc_priv_flags_strings' is not needed and will not be emitted [-Wunneeded-internal-declaration]
> > static const char igc_priv_flags_strings[][ETH_GSTRING_LEN] = {
> >                   ^
> > 1 warning generated.
> >
> > igc_priv_flags_strings is only used in an ARRAY_SIZE macro, which is a
> > compile time evaluation, so no reference to it is being emitted in the
> > final assembly. Is it actually needed and was forgotten to be used
> > somewhere or could it be eliminated so that Clang no longer warns?
>
> That's because the driver provides get_priv_flags() and set_priv_flags()
> callbacks in its ethtool_ops to allow querying and setting legacy-rx
> private flag but it does not provide get_sset_count() and get_strings()
> to provide list of private flags to userspace ethtool.

So the variable declaration should get a `__unused` annotation then
(and maybe a comment)?

-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2019-03-01 18:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  5:09 Clang warning in drivers/net/ethernet/intel/igc/igc_ethtool.c Nathan Chancellor
2019-02-08 14:34 ` Michal Kubecek
2019-03-01 18:28   ` Nick Desaulniers [this message]
2019-03-01 20:40     ` Michal Kubecek

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=CAKwvOdkNv_HUREJhUdOgHBgmVghPvJUun5wYuknCfTO0zN5TAg@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=aaron.f.brown@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=natechancellor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sasha.neftin@intel.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;
as well as URLs for NNTP newsgroup(s).