All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matt Turner" <mattst88@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3 6/7] hwmon: Add driver for Marvel AlphaServer environmental sensors
Date: Tue, 17 Nov 2026 18:26:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-219339@kernel.org> (raw)
In-Reply-To: <20261117-marvel-env-v3-6-0edc370fdca9@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] hwmon: (marvel-env) off-by-one nr_info check in
  marvel_env_probe()
--

commit 6fbd587456a10850baa1d383c9628002e5d61c42
Author: Matt Turner <mattst88@gmail.com>

hwmon: Add driver for Marvel AlphaServer environmental sensors

This commit adds a hwmon driver for the temperature, fan, voltage, and
power supply environmental sensors exposed via the SRM console config
tree (GCT) on Marvel (EV7) AlphaServers.

> diff --git a/drivers/hwmon/marvel-env.c b/drivers/hwmon/marvel-env.c
> new file mode 100644
> index 0000000000000..25c0ecef8e1d6
> --- /dev/null
> +++ b/drivers/hwmon/marvel-env.c
[ ... ]
> +static int marvel_env_probe(struct platform_device *pdev)
> +{
> +	u32 *config[hwmon_max] = { };
> +	struct device *dev = &pdev->dev;
> +	const struct hwmon_channel_info **info;
> +	struct marvel_env_data *data;
> +	struct hwmon_chip_info *chip;
> +	struct device *hwmon;
> +	unsigned int i, k, nr_info = 0;
[ ... ]
> +	for (k = 0; k < ARRAY_SIZE(marvel_env_types); k++) {
> +		enum hwmon_sensor_types type = marvel_env_types[k];
> +		struct hwmon_channel_info *ci;
> +
> +		if (!data->nr_chans[type])
> +			continue;
> +		data->chans[type] = devm_kcalloc(dev, data->nr_chans[type],
> +						 sizeof(*data->chans[type]),
> +						 GFP_KERNEL);
> +		ci = devm_kzalloc(dev, sizeof(*ci), GFP_KERNEL);
> +		config[type] = devm_kcalloc(dev, data->nr_chans[type] + 1,
> +					    sizeof(*config[type]), GFP_KERNEL);
> +		if (!data->chans[type] || !ci || !config[type])
> +			return -ENOMEM;
> +		ci->type = type;
> +		ci->config = config[type];
> +		info[nr_info++] = ci;
> +		data->max_chans[type] = data->nr_chans[type];
> +		data->nr_chans[type] = 0;
> +	}
> +	if (nr_info == 1)
> +		return -ENODEV;

[Severity: Medium]
Should this check be if (!nr_info) instead of if (nr_info == 1)?

nr_info starts at 0 and is incremented once per populated sensor type in
marvel_env_types[], so checking nr_info == 1 rejects a valid system with
a single sensor category with -ENODEV and lets the zero-channel case fall
through into devm_hwmon_device_register_with_info() with an empty info
array.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-marvel-env-v3-0-0edc370fdca9@gmail.com?part=6

  reply	other threads:[~2026-11-17 18:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 18:13 [PATCH v3 0/7] alpha: marvel: environmental sensors Matt Turner
2026-11-17 18:13 ` [PATCH v3 1/7] alpha: marvel: fix the environmental subpacket layout Matt Turner
2026-11-17 18:17   ` sashiko-bot
2026-11-17 20:11   ` Magnus Lindholm
2026-11-17 18:13 ` [PATCH v3 2/7] alpha: marvel: report environmental events without VERBOSE_MCHECK Matt Turner
2026-11-17 18:18   ` sashiko-bot
2026-11-17 18:13 ` [PATCH v3 3/7] alpha: marvel: refresh environmental readings through the console Matt Turner
2026-11-17 18:20   ` sashiko-bot
2026-11-17 20:12   ` Magnus Lindholm
2026-11-17 18:13 ` [PATCH v3 4/7] alpha: marvel: notify environmental events Matt Turner
2026-11-17 18:18   ` sashiko-bot
2026-11-17 18:13 ` [PATCH v3 5/7] alpha: marvel: register a platform device for the environmental sensors Matt Turner
2026-11-17 18:18   ` sashiko-bot
2026-11-17 18:13 ` [PATCH v3 6/7] hwmon: Add driver for Marvel AlphaServer " Matt Turner
2026-11-17 18:26   ` sashiko-bot [this message]
2026-11-17 21:00   ` Magnus Lindholm
2026-11-17 18:13 ` [PATCH v3 7/7] hwmon: (marvel-env) Notify userspace of environmental events Matt Turner
2026-11-17 18:26   ` sashiko-bot

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=sashiko-outbox-219339@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=mattst88@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.