Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Maximilian Luz <luzmaximilian@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Ivor Wanders <ivor@iwanders.net>,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v4] hwmon: Add thermal sensor driver for Surface Aggregator Module
Date: Tue, 13 Aug 2024 20:42:37 +0200	[thread overview]
Message-ID: <708755c1-9f78-4554-b0c7-6fb6f7715364@gmail.com> (raw)
In-Reply-To: <9c54fd98-7e59-4cfd-b005-64af558541b5@roeck-us.net>

On 8/13/24 8:19 PM, Guenter Roeck wrote:
> On Sun, Aug 11, 2024 at 02:14:41AM +0200, Maximilian Luz wrote:
>> Some of the newer Microsoft Surface devices (such as the Surface Book
>> 3 and Pro 9) have thermal sensors connected via the Surface Aggregator
>> Module (the embedded controller on those devices). Add a basic driver
>> to read out the temperature values of those sensors.
>>
>> The EC can have up to 16 thermal sensors connected via a single
>> sub-device, each providing temperature readings and a label string.
>>
>> Link: https://github.com/linux-surface/surface-aggregator-module/issues/59
>> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>> Co-developed-by: Ivor Wanders <ivor@iwanders.net>
>> Signed-off-by: Ivor Wanders <ivor@iwanders.net>
>> Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
> 
> Applied. One comment below, though.
> 
>> ---
>> +
>> +	/*
>> +	 * This should not fail unless the name in the returned struct is not
>> +	 * null-terminated or someone changed something in the struct
>> +	 * definitions above, since our buffer and struct have the same
>> +	 * capacity by design. So if this fails, log an error message. Since
>> +	 * the more likely cause is that the returned string isn't
>> +	 * null-terminated, we might have received garbage (as opposed to just
>> +	 * an incomplete string), so also fail the function.
>> +	 */
>> +	status = strscpy(buf, name_rsp.name, buf_len);
>> +	if (status < 0) {
>> +		dev_err(&sdev->dev, "received non-null-terminated sensor name string\n");
>> +		return status;
>> +	}
> 
> If that ever happens, it will likely be permanent and clog the kernel log.
> Normally I'd ask you to make it _once, but I am kind of tired right now of
> having to explain to people that clogging the kernel log isn't really a
> good idea - even more so if the message doesn't provide any real value.

Ah, I didn't even think about that. I can send in a follow-up patch if
you want me to.

Currently it should be fine since we are failing the whole driver if
this does not work out. But using dev_err_once() would be more
forward-thinking in case we ever change that.

Thanks!

Best regards,
Max

      reply	other threads:[~2024-08-13 18:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11  0:14 [PATCH v4] hwmon: Add thermal sensor driver for Surface Aggregator Module Maximilian Luz
2024-08-13 18:19 ` Guenter Roeck
2024-08-13 18:42   ` Maximilian Luz [this message]

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=708755c1-9f78-4554-b0c7-6fb6f7715364@gmail.com \
    --to=luzmaximilian@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ivor@iwanders.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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