All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nikita Dubrovskih" <testname142@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [RFC PATCH] hwmon: Add fan monitoring support for HONOR FMI-XX
Date: Wed, 12 Aug 2026 19:32:49 +0000	[thread overview]
Message-ID: <20260812193249.83FBF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812192242.859307-1-testname142@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The function `honor_fmi_read_rpm` illegally mixes `goto`-based error handling with a scoped `guard(mutex)` lock.
- [Low] The new entry in the MAINTAINERS file is inserted out of alphabetical order.
--

--- Patch [1]: [RFC PATCH] hwmon: Add fan monitoring support for HONOR FMI-XX ---
commit 8d90c25d369a88a7d4700de11f8a23c2eaf15bbc
Author: Nikita Dubrovskih <testname142@gmail.com>

hwmon: Add fan monitoring support for HONOR FMI-XX

This patch introduces a read-only hwmon driver for HONOR FMI-XX laptops.
It queries fan speeds using the firmware-provided \GFNS ACPI method and 
exposes the results via sysfs.

> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8014b9f8253ed..d7355db80288e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11854,6 +11854,13 @@ F:	lib/test_hmm*
>  F:	mm/hmm*
>  F:	tools/testing/selftests/mm/*hmm*
>  
> +HONOR FMI-XX HARDWARE MONITOR DRIVER
> +M:	Nikita Dubrovskih <testname142@gmail.com>
> +L:	linux-hwmon@vger.kernel.org
> +S:	Maintained
> +F:	Documentation/hwmon/honor-fmi.rst
> +F:	drivers/hwmon/honor-fmi.c
> +
>  HONEYWELL ABP2030PA PRESSURE SENSOR SERIES IIO DRIVER

[Severity: Low]
This isn't a bug, but should this new entry be placed after HONEYWELL?

Alphabetically, "HONOR" comes after "HONEYWELL" (O follows E), so inserting
it here breaks the alphabetical order of the MAINTAINERS file.

[ ... ]

> diff --git a/drivers/hwmon/honor-fmi.c b/drivers/hwmon/honor-fmi.c
> new file mode 100644
> index 0000000000000..225066e9add5f
> --- /dev/null
> +++ b/drivers/hwmon/honor-fmi.c
[ ... ]
> +static int honor_fmi_read_rpm(struct honor_fmi_data *data, int channel,
> +			      long *rpm)
> +{
> +	union acpi_object input = {
> +		.buffer = {
> +			.type = ACPI_TYPE_BUFFER,
> +			.length = 3,
> +		},
> +	};
> +	struct acpi_object_list arguments = {
> +		.count = 1,
> +		.pointer = &input,
> +	};
> +	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> +	union acpi_object *result;
> +	u8 input_bytes[3] = { 0, 0, channel };
> +	acpi_status status;
> +	int ret = 0;
> +
> +	input.buffer.pointer = input_bytes;
> +
> +	guard(mutex)(&data->lock);
> +	status = acpi_evaluate_object(data->gfns, NULL, &arguments, &output);
> +	if (ACPI_FAILURE(status))
> +		return -EIO;
> +
> +	result = output.pointer;
> +	if (!result || result->type != ACPI_TYPE_BUFFER ||
> +	    result->buffer.length < HONOR_FMI_GFNS_RESULT_SIZE) {
> +		ret = -EPROTO;
> +		goto out_free;
> +	}
> +
> +	if (result->buffer.pointer[0]) {
> +		ret = -EIO;
> +		goto out_free;
> +	}
> +
> +	*rpm = result->buffer.pointer[1] |
> +	       (result->buffer.pointer[2] << 8);
> +
> +out_free:
> +	kfree(output.pointer);
> +	return ret;
> +}

[Severity: Low]
Does this function mix goto-based error handling with scope-based cleanups?

The cleanup subsystem guidelines request that guard() helpers and goto-based
cleanups are not mixed in the same function. 

Could the output buffer be managed using __free(kfree) to completely
eliminate the out_free label?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812192242.859307-1-testname142@gmail.com?part=1

  reply	other threads:[~2026-08-12 19:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 19:22 [RFC PATCH] hwmon: Add fan monitoring support for HONOR FMI-XX Nikita Dubrovskih
2026-08-12 19:32 ` sashiko-bot [this message]
2026-08-12 22:49 ` Guenter Roeck

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=20260812193249.83FBF1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=testname142@gmail.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 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.