From: Simon Horman <horms@kernel.org>
To: Kurt Kanzenbach <kurt@linutronix.de>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Vinicius Costa Gomes <vinicius.gomes@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Andrew Lunn <andrew@lunn.ch>,
Dan Carpenter <carpenter@linaro.org>
Subject: Re: [PATCH v1 iwl-next] igc: Add support for LEDs on i225/i226
Date: Thu, 25 Jan 2024 11:53:18 +0000 [thread overview]
Message-ID: <20240125115318.GI217708@kernel.org> (raw)
In-Reply-To: <87h6j1ev5j.fsf@kurt.kurt.home>
+ Dan Carpenter <carpenter@linaro.org>
On Thu, Jan 25, 2024 at 08:20:40AM +0100, Kurt Kanzenbach wrote:
> On Wed Jan 24 2024, Simon Horman wrote:
> > On Wed, Jan 24, 2024 at 09:24:08AM +0100, Kurt Kanzenbach wrote:
> >
> > ...
> >
> >> +static int igc_led_hw_control_set(struct led_classdev *led_cdev,
> >> + unsigned long flags)
> >> +{
> >> + struct igc_led_classdev *ldev = lcdev_to_igc_ldev(led_cdev);
> >> + struct igc_adapter *adapter = netdev_priv(ldev->netdev);
> >> + bool blink = false;
> >> + u32 mode;
> >> +
> >> + if (flags & BIT(TRIGGER_NETDEV_LINK_10))
> >> + mode = IGC_LEDCTL_MODE_LINK_10;
> >> + if (flags & BIT(TRIGGER_NETDEV_LINK_100))
> >> + mode = IGC_LEDCTL_MODE_LINK_100;
> >> + if (flags & BIT(TRIGGER_NETDEV_LINK_1000))
> >> + mode = IGC_LEDCTL_MODE_LINK_1000;
> >> + if (flags & BIT(TRIGGER_NETDEV_LINK_2500))
> >> + mode = IGC_LEDCTL_MODE_LINK_2500;
> >> + if ((flags & BIT(TRIGGER_NETDEV_TX)) ||
> >> + (flags & BIT(TRIGGER_NETDEV_RX)))
> >> + mode = IGC_LEDCTL_MODE_ACTIVITY;
> >
> > Hi Kurt,
> >
> > I guess this can't happen in practice,
> > but if none of the conditions above are met,
> > then mode is used uninitialised below.
>
> Yes, it shouldn't happen, because the supported modes are
> checked. However, mode can be initialized to off to avoid the warning.
Thanks.
> > Flagged by Smatch.
>
> Out of curiosity how did you get the warning? I usually run `make W=1 C=1
> M=...` before sending patches.
Probably there is a better way, but I run Smatch like this:
.../smatch/smatch_scripts/kchecker a.c
Smatch can be found here:
https://github.com/error27/smatch
next prev parent reply other threads:[~2024-01-25 11:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 8:24 [PATCH v1 iwl-next] igc: Add support for LEDs on i225/i226 Kurt Kanzenbach
2024-01-24 21:08 ` Simon Horman
2024-01-25 7:20 ` Kurt Kanzenbach
2024-01-25 11:53 ` Simon Horman [this message]
2024-01-24 21:52 ` Andrew Lunn
2024-01-25 7:31 ` Kurt Kanzenbach
2024-01-25 16:47 ` Andrew Lunn
2024-01-26 8:37 ` Kurt Kanzenbach
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=20240125115318.GI217708@kernel.org \
--to=horms@kernel.org \
--cc=andrew@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=bigeasy@linutronix.de \
--cc=carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vinicius.gomes@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).