All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Akhil R" <akhilrajeev@nvidia.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3 11/13] hwmon: spd5118: Remove 16-bit addressing
Date: Fri, 24 Apr 2026 01:03:42 +0000	[thread overview]
Message-ID: <20260424010342.BB42FC2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260423085718.70762-12-akhilrajeev@nvidia.com>

Sashiko AI review found 1 potential issue(s):
- [Medium] The driver violates hwmon subsystem locking rules by using a custom `nvmem_lock`, and correcting this exposes an initialization order race condition where the NVMEM interface is exposed before the hwmon device is registered.
--

commit 8460c5a9338d8916bf61ccb3e598518750ec6cf9
Author: Akhil R <akhilrajeev@nvidia.com>

hwmon: spd5118: Remove 16-bit addressing

This commit removes 16-bit addressing support for the spd5118 driver,
as it is not required for I3C and has no known users. It updates the
regmap configuration and probe functions to only use 8-bit addressing.

> diff --git a/drivers/hwmon/spd5118.c b/drivers/hwmon/spd5118.c
> index 5da44571b6a0ce..8fdde35e68cd3f 100644
> --- a/drivers/hwmon/spd5118.c
> +++ b/drivers/hwmon/spd5118.c
> @@ -78,7 +75,6 @@ static const unsigned short normal_i2c[] = {
>  struct spd5118_data {
>  	struct regmap *regmap;
>  	struct mutex nvmem_lock;
> -	bool is_16bit;
>  };

Does this custom lock violate the hwmon subsystem locking guidelines?

The guidelines state that drivers must serialize attributes registered by
other means using hwmon_lock() and hwmon_unlock().

If this code is updated to comply with the guideline by replacing
nvmem_lock with hwmon_lock(data->hwmon_dev), could it expose a race
condition during initialization?

Looking at spd5118_common_probe():

spd5118_common_probe()
    spd5118_nvmem_init(dev, data);
    ...
    hwmon_dev = devm_hwmon_device_register_with_info(dev, ...);

Since spd5118_nvmem_init() is called before the hwmon device is registered,
would this expose the nvmem sysfs file to userspace while the hwmon
locking context is still unregistered, potentially leading to a NULL
pointer dereference?

Should the hwmon device registration happen before the nvmem device
registration to prevent this sequence?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260423085718.70762-1-akhilrajeev@nvidia.com?part=11

  reply	other threads:[~2026-04-24  1:03 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23  8:56 [PATCH v3 00/13] Support ACPI and SETAASA device discovery Akhil R
2026-04-23  8:56 ` Akhil R
2026-04-23  8:57 ` [PATCH v3 01/13] dt-bindings: i3c: Add mipi-i3c-static-method to support SETAASA Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-23 11:23   ` sashiko-bot
2026-05-05 21:32     ` Rob Herring
2026-05-05 22:17       ` Guenter Roeck
2026-05-05 23:12         ` Rob Herring
2026-04-23  8:57 ` [PATCH v3 02/13] ACPICA: Read LVR from the I2C resource descriptor Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-23 19:35   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 03/13] i3c: master: Use unified device property interface Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-23 20:08   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 04/13] i3c: master: Support ACPI enumeration of child devices Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-23 22:11   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 05/13] i3c: master: Add support for devices using SETAASA Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-23 22:36   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 06/13] i3c: master: Add support for devices without PID Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-23 23:01   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 07/13] i3c: master: match I3C device through DT and ACPI Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-23 23:27   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 08/13] i3c: dw-i3c-master: Add SETAASA as supported CCC Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-23  8:57 ` [PATCH v3 09/13] i3c: dw-i3c-master: Add a quirk to skip clock and reset Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-24  0:18   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 10/13] i3c: dw-i3c-master: Add ACPI ID for Tegra410 Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-24  0:34   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 11/13] hwmon: spd5118: Remove 16-bit addressing Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-24  1:03   ` sashiko-bot [this message]
2026-04-23  8:57 ` [PATCH v3 12/13] hwmon: spd5118: Add I3C support Akhil R
2026-04-23  8:57   ` Akhil R
2026-04-24  3:08   ` sashiko-bot
2026-04-23  8:57 ` [PATCH v3 13/13] arm64: defconfig: Enable I3C and SPD5118 hwmon Akhil R
2026-04-23  8:57   ` Akhil R

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=20260424010342.BB42FC2BCAF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akhilrajeev@nvidia.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=sashiko@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.