Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Filip Gołaś" <filip.golas@3mdeb.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3 3/3] platform/x86: dasharo-acpi: Add EC fan curve support
Date: Fri, 27 Nov 2026 07:52:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-236839@kernel.org> (raw)
In-Reply-To: <20261127074518.3244152-4-filip.golas@3mdeb.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] platform/x86: dasharo-acpi: missing channels 3..24 in
  dasharo_point_attrs
- [Low] platform/x86: dasharo-acpi: unused variable ret in
  dasharo_probe()
- [Low] platform/x86: dasharo-acpi: signed overflow in
  curve_point_temp_store()
--

commit 9cf5d657df4ad48be24caa750474d3b7ec90257c
Author: Filip Gołaś <filip.golas@3mdeb.com>

platform/x86: dasharo-acpi: Add EC fan curve support

This commit exposes the four-point EC fan curve through hwmon
pwmN_auto_pointM_temp and pwmN_auto_pointM_pwm attributes and asks the
firmware to persist the curve on shutdown.

> diff --git a/drivers/platform/x86/dasharo-acpi.c b/drivers/platform/x86/dasharo-acpi.c
> index 85f88b11fcf98..c0b65f5e4146f 100644
> --- a/drivers/platform/x86/dasharo-acpi.c
> +++ b/drivers/platform/x86/dasharo-acpi.c
[ ... ]
> @@ -407,6 +409,197 @@ static const struct hwmon_chip_info dasharo_hwmon_chip_info = {
[ ... ]
> +static ssize_t curve_point_temp_store(struct device *dev, struct device_attribute *attr,
> +				      const char *buf, size_t count)
> +{
> +	struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
> +	struct dasharo_data *data = dev_get_drvdata(dev);
> +	long val;
> +	int err;
> +
> +	err = kstrtol(buf, 10, &val);
> +	if (err)
> +		return err;
> +
> +	if (val < 0)
> +		return -EINVAL;
> +
> +	val = DIV_ROUND_CLOSEST(val, MILLIDEGREE_PER_DEGREE);
> +	if (val > U8_MAX)
> +		return -EINVAL;

[Severity: Low]
Can DIV_ROUND_CLOSEST(val, MILLIDEGREE_PER_DEGREE) overflow signed long
when val is within 499 of LONG_MAX?  Adding 500 wraps val to a negative
number that bypasses the val > U8_MAX check and is sign-extended to u64
when passed to dasharo_curve_point_store().

[ ... ]

> +DASHARO_POINT_ATTRS(1);
> +DASHARO_POINT_ATTRS(2);
> +DASHARO_POINT_ATTRS(3);
[ ... ]
> +DASHARO_POINT_ATTRS(24);
> +
> +static struct attribute *dasharo_point_attrs[] = {
> +	DASHARO_CHANNEL_PTRS(1),
> +	DASHARO_CHANNEL_PTRS(2),
> +	NULL
> +};

[Severity: High]
As reported by Michał Kopeć on v2 [1], should dasharo_point_attrs[] also
include DASHARO_CHANNEL_PTRS(3) through DASHARO_CHANNEL_PTRS(24)?
Omitting them leaves the static attribute structs for channels 3..24
unreferenced, triggering 176 -Wunused-variable warnings (breaking
CONFIG_WERROR=y builds) and leaving channels 3..24 without curve point
sysfs attributes.

[ ... ]

> @@ -437,21 +630,33 @@ static int dasharo_probe(struct platform_device *pdev)
>  {
>  	struct dasharo_data *data;
>  	struct device *hwmon;
> +	int ret;

[Severity: Low]
Is ret unused in dasharo_probe(), causing a -Wunused-variable warning?

[1] https://lore.kernel.org/r/20261126165506.2793034-1-michal.kopec@3mdeb.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127074518.3244152-1-filip.golas@3mdeb.com?part=3

  reply	other threads:[~2026-11-27  7:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  7:45 [PATCH v3 0/3] platform/x86: dasharo-acpi: Add fan control Filip Gołaś
2026-11-27  7:45 ` [PATCH v3 1/3] platform/x86: dasharo-acpi: Extract dasharo_call() from dasharo_read_channel() Filip Gołaś
2026-11-27  7:45 ` [PATCH v3 2/3] platform/x86: dasharo-acpi: Add fan mode and PWM write support Filip Gołaś
2026-11-27  7:45 ` [PATCH v3 3/3] platform/x86: dasharo-acpi: Add EC fan curve support Filip Gołaś
2026-11-27  7:52   ` sashiko-bot [this message]
2026-11-27  7:52 ` [PATCH v3 0/3] platform/x86: dasharo-acpi: Add fan control 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-236839@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=filip.golas@3mdeb.com \
    --cc=linux-hwmon@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox