netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>
Subject: Re: [PATCH v1 iwl-next] igc: Add support for LEDs on i225/i226
Date: Wed, 24 Jan 2024 21:08:55 +0000	[thread overview]
Message-ID: <20240124210855.GC217708@kernel.org> (raw)
In-Reply-To: <20240124082408.49138-1-kurt@linutronix.de>

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.

Flagged by Smatch.

> +
> +	/* blink is recommended for activity */
> +	if (mode == IGC_LEDCTL_MODE_ACTIVITY)
> +		blink = true;
> +
> +	igc_led_set(adapter, ldev->index, mode, blink);
> +
> +	return 0;
> +}

...

  reply	other threads:[~2024-01-24 21:09 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 [this message]
2024-01-25  7:20   ` Kurt Kanzenbach
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=20240124210855.GC217708@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=bigeasy@linutronix.de \
    --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).