All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luiz Angelo Daros de Luca" <luizluca@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/6] hwmon: (adt7470) Fix fans stuck in manual mode on I2C errors
Date: Fri, 17 Jul 2026 21:10:45 +0000	[thread overview]
Message-ID: <20260717211046.66B001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260717-adt7470_thermalzone-v2-2-a55147958fad@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the driver violates hwmon subsystem guidelines by using a private mutex `data->lock` for sysfs attributes instead of the standard `hwmon_lock()` API.
--

--- Patch [2]: [PATCH v2 2/6] hwmon: (adt7470) Fix fans stuck in manual mode on I2C errors ---
commit f5bf8b0ee6f2d048580f6d00a71e61df362fa4c6
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>

hwmon: (adt7470) Fix fans stuck in manual mode on I2C errors

This commit introduces a recovery path in adt7470_read_temperatures() to ensure
that original PWM configuration registers are restored if an I2C operation
fails after temporarily switching the fans to manual mode.

Closes: https://lore.kernel.org/r/20260716213252.EACA71F000E9@smtp.kernel.org

> diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
> index 664349756dc2b..481d51617f4be 100644
> --- a/drivers/hwmon/adt7470.c
> +++ b/drivers/hwmon/adt7470.c
> @@ -205,11 +205,12 @@ static inline int adt7470_write_word_data(struct adt7470_data *data, unsigned in
>  /* Probe for temperature sensors.  Assumes lock is held */
>  static int adt7470_read_temperatures(struct adt7470_data *data)
>  {

[Severity: High]
This isn't a bug introduced by this patch, but this driver appears to use a
private mutex (data->lock) for internal synchronization instead of the
standard hwmon_lock() API.

For example, it uses mutex_init(&data->lock) in adt7470_probe() and locks it
with mutex_lock(&data->lock) in sysfs attribute operations like
pwm_auto_temp_store().

Does this bypass the centralized hwmon core serialization mechanism and risk
logical race conditions with the thermal subsystem? Should this be updated
to follow the hwmon subsystem guidelines which mandate using hwmon_lock()
and hwmon_unlock() for attributes not registered via the info parameter?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260717-adt7470_thermalzone-v2-0-a55147958fad@gmail.com?part=2

  reply	other threads:[~2026-07-17 21:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 20:59 [PATCH v2 0/6] hwmon: (adt7470) Add thermal zone and PWM provider support Luiz Angelo Daros de Luca
2026-07-17 20:59 ` [PATCH v2 1/6] dt-bindings: hwmon: add binding for adi,adt7470 Luiz Angelo Daros de Luca
2026-07-17 21:04   ` sashiko-bot
2026-07-17 20:59 ` [PATCH v2 2/6] hwmon: (adt7470) Fix fans stuck in manual mode on I2C errors Luiz Angelo Daros de Luca
2026-07-17 21:10   ` sashiko-bot [this message]
2026-07-17 20:59 ` [PATCH v2 3/6] hwmon: (adt7470) Fix busy-loop and I2C flooding in update thread Luiz Angelo Daros de Luca
2026-07-17 21:12   ` sashiko-bot
2026-07-17 20:59 ` [PATCH v2 4/6] hwmon: (adt7470) Add ADT7470_PWM_MAX macro Luiz Angelo Daros de Luca
2026-07-17 21:05   ` sashiko-bot
2026-07-17 20:59 ` [PATCH v2 5/6] hwmon: (adt7470) Register as a PWM provider Luiz Angelo Daros de Luca
2026-07-17 21:17   ` sashiko-bot
2026-07-17 20:59 ` [PATCH v2 6/6] hwmon: (adt7470) Add thermal zone sensor support Luiz Angelo Daros de Luca
2026-07-17 21:09   ` 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=20260717211046.66B001F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=luizluca@gmail.com \
    --cc=robh@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 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.