netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kurt Kanzenbach <kurt@linutronix.de>
To: Simon Horman <horms@kernel.org>
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>
Subject: Re: [PATCH v1 iwl-next] igc: Add support for LEDs on i225/i226
Date: Thu, 25 Jan 2024 08:20:40 +0100	[thread overview]
Message-ID: <87h6j1ev5j.fsf@kurt.kurt.home> (raw)
In-Reply-To: <20240124210855.GC217708@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1287 bytes --]

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.

>
> Flagged by Smatch.

Out of curiosity how did you get the warning? I usually run `make W=1 C=1
M=...` before sending patches.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

  reply	other threads:[~2024-01-25  7:20 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 [this message]
2024-01-25 11:53     ` Simon Horman
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=87h6j1ev5j.fsf@kurt.kurt.home \
    --to=kurt@linutronix.de \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --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).