Linux Documentation
 help / color / mirror / Atom feed
From: Vas Zayarskiy <contact@vasily.cc>
To: linux@roeck-us.net, Aleksa Savic <savicaleksa83@gmail.com>,
	Jack Doan <me@jackdoan.com>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: [PATCH v5 4/5] hwmon: (aquacomputer_d5next) Skip unknown firmware version offsets
Date: Sun, 27 Sep 2026 22:13:15 +0300	[thread overview]
Message-ID: <20260927191316.4137752-5-contact@vasily.cc> (raw)
In-Reply-To: <20260927191316.4137752-1-contact@vasily.cc>

Only decode the firmware version when its offset is known, matching the
condition used to expose the firmware_version debugfs file. This lets a
device leave the offset at zero without interpreting the report ID and
following byte as a firmware version.

Assisted-by: LLM sparse
Signed-off-by: Vas Zayarskiy <contact@vasily.cc>
---
 drivers/hwmon/aquacomputer_d5next.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
index f80027b27..13272eb88 100644
--- a/drivers/hwmon/aquacomputer_d5next.c
+++ b/drivers/hwmon/aquacomputer_d5next.c
@@ -1344,7 +1344,8 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
 	priv->serial_number[0] = get_unaligned_be16(data + priv->serial_number_start_offset);
 	priv->serial_number[1] = get_unaligned_be16(data + priv->serial_number_start_offset +
 						    SERIAL_PART_OFFSET);
-	priv->firmware_version = get_unaligned_be16(data + priv->firmware_version_offset);
+	if (priv->firmware_version_offset)
+		priv->firmware_version = get_unaligned_be16(data + priv->firmware_version_offset);
 
 	/* Physical temperature sensor readings */
 	for (i = 0; i < priv->num_temp_sensors; i++) {

  parent reply	other threads:[~2026-09-27 19:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 19:13 [PATCH v5 0/5] hwmon: AMPINEL telemetry support and shared fixes Vas Zayarskiy
2026-09-27 19:13 ` [PATCH v5 1/5] hwmon: (aquacomputer_d5next) Avoid truncating scaled sensor readings Vas Zayarskiy
2026-09-27 19:13 ` [PATCH v5 2/5] hwmon: (aquacomputer_d5next) Expire the initial sensor cache Vas Zayarskiy
2026-09-27 19:13 ` [PATCH v5 3/5] hwmon: (aquacomputer_d5next) Validate incoming status reports Vas Zayarskiy
2026-09-27 19:13 ` Vas Zayarskiy [this message]
2026-09-27 19:13 ` [PATCH v5 5/5] hwmon: (aquacomputer_d5next) Add AMPINEL telemetry support Vas Zayarskiy

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=20260927191316.4137752-5-contact@vasily.cc \
    --to=contact@vasily.cc \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=me@jackdoan.com \
    --cc=rdunlap@infradead.org \
    --cc=savicaleksa83@gmail.com \
    --cc=skhan@linuxfoundation.org \
    /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