All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Akshay Gupta" <Akshay.Gupta@amd.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3 4/8] misc: amd-sbi: Consolidate Common SBTSI Probe Path for I2C and I3C
Date: Mon, 22 Jun 2026 14:11:39 +0000	[thread overview]
Message-ID: <20260622141139.8DFF21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622135821.2190260-5-Akshay.Gupta@amd.com>

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

Pre-existing issues:
- [High] The auxiliary device ID (`adev->id`) is set directly to the bus device address, causing sysfs naming collisions on multi-bus systems.
--

commit 30f30dcfe1c0110443187a8e9e5a7a6452445301
Author: Prathima <Prathima.Lk@amd.com>

misc: amd-sbi: Consolidate Common SBTSI Probe Path for I2C and I3C

This commit refactors the shared probe procedures into a new common
function, sbtsi_probe_common(). This consolidation ensures that I2C
and I3C probes can share the bus-specific allocation and device
configuration logic.

> diff --git a/drivers/misc/amd-sbi/tsi.c b/drivers/misc/amd-sbi/tsi.c
> index dfdd730b906af..a4c7e1be5624d 100644
> --- a/drivers/misc/amd-sbi/tsi.c
> +++ b/drivers/misc/amd-sbi/tsi.c
> @@ -84,25 +84,35 @@ static int sbtsi_create_hwmon_adev(struct device *dev, u8 dev_addr)

[ ... ]

> +static int sbtsi_probe_common(struct device *dev, struct sbtsi_data *data)
> +{
> +	u8 val;
> +	int err;
> +
> +	err = sbtsi_xfer(data, SBTSI_REG_CONFIG, &val, true);
> +	if (err)
> +		return err;
> +
> +	data->ext_range_mode = FIELD_GET(BIT(SBTSI_CONFIG_EXT_RANGE_SHIFT), val);
> +	data->read_order = FIELD_GET(BIT(SBTSI_CONFIG_READ_ORDER_SHIFT), val);
> +
> +	dev_set_drvdata(dev, data);
> +	return sbtsi_create_hwmon_adev(dev, data->dev_addr);

[Severity: High]
This isn't a bug introduced by this patch, but is it safe to use
data->dev_addr directly as the auxiliary device ID here?

Looking at sbtsi_create_hwmon_adev(), it assigns adev->id = dev_addr. This
causes sysfs naming collisions on multi-bus systems. While the existing code
comment assumes unique static addresses per socket, this breaks down on
topologies where identical sensors reside on independent I2C controllers.

Furthermore, if an upcoming patch introduces I3C support and sets this
address from the I3C dynamic address, collisions are virtually guaranteed
on multi-bus I3C systems. When a collision occurs, device_add() will fail
with a duplicate sysfs kobject name error, causing the probe to
deterministically fail.

Should this be updated to use the ida subsystem (e.g., ida_alloc()) to
assign guaranteed unique auxiliary device IDs?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260622135821.2190260-1-Akshay.Gupta@amd.com?part=4

  reply	other threads:[~2026-06-22 14:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 13:58 [PATCH v3 0/8] misc: amd-sbi: Refactor SBTSI driver with I3C support and ioctl interface Akshay Gupta
2026-06-22 13:58 ` [PATCH v3 1/8] hwmon/misc: amd-sbi: Move core sbtsi support from hwmon to misc Akshay Gupta
2026-06-22 14:12   ` sashiko-bot
2026-06-22 13:58 ` [PATCH v3 2/8] hwmon: sbtsi_temp: Refactor temperature register access into helpers Akshay Gupta
2026-06-22 14:11   ` sashiko-bot
2026-06-22 13:58 ` [PATCH v3 3/8] hwmon/misc: amd-sbi: Move sbtsi register transfer to core abstraction Akshay Gupta
2026-06-22 14:18   ` sashiko-bot
2026-06-22 13:58 ` [PATCH v3 4/8] misc: amd-sbi: Consolidate Common SBTSI Probe Path for I2C and I3C Akshay Gupta
2026-06-22 14:11   ` sashiko-bot [this message]
2026-06-22 13:58 ` [PATCH v3 5/8] misc: amd-sbi: Add support for SB-TSI over I3C Akshay Gupta
2026-06-22 14:19   ` sashiko-bot
2026-06-22 13:58 ` [PATCH v3 6/8] misc: amd-sbi: Add SBTSI ioctl register transfer interface Akshay Gupta
2026-06-22 14:15   ` sashiko-bot
2026-06-22 13:58 ` [PATCH v3 7/8] hwmon: Add mutex protecting for sbtsi read/write through hwmon Akshay Gupta
2026-06-22 14:17   ` sashiko-bot
2026-06-22 13:58 ` [PATCH v3 8/8] docs: misc: amd-sbi: Document SBTSI userspace interface Akshay Gupta
2026-06-22 14:12   ` sashiko-bot
2026-06-22 16:57   ` Randy Dunlap

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=20260622141139.8DFF21F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Akshay.Gupta@amd.com \
    --cc=linux-hwmon@vger.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.