From: Vincent Jardin <vjardin@free.fr>
To: sashiko-reviews@lists.linux.dev
Cc: linux-hwmon@vger.kernel.org, robh@kernel.org,
conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] hwmon: pmbus: add MPQ8646 driver
Date: Thu, 23 Jul 2026 16:42:58 +0200 [thread overview]
Message-ID: <amIocoxA_omNKz-I@L30177.local> (raw)
In-Reply-To: <20260723131952.198BD1F000E9@smtp.kernel.org>
Hi Bot,
> [Severity: High]
> Does this pass stack-allocated buffers to i2c_transfer()? Since many I2C
> host controllers use DMA, mapping stack memory for DMA can cause a kernel
> panic if CONFIG_VMAP_STACK is enabled. Should these buffers be dynamically
> allocated?
According to Documentation/i2c/dma-considerations.rst:
"it is NOT mandatory that the buffer of an I2C message is DMA safe
Since DMA safety is opt-in per message via I2C_M_DMA_SAFE which means that
Users of i2c_transfer() shall set the I2C_M_DMA_SAFE flag manually,
and the host drivers doing DMA get "either msg->buf for the I2C_M_DMA_SAFE case
or a bounce buffer" from i2c_get_dma_safe_msg_buf().
These messages do not set the flag, and at 1 and 2 bytes they are far below the
about 8-byte DMA thresholds the same document describes. This is also a root-only
debugfs probe helper.
-> So no.
> Will these coefficients result in the correct voltage scaling? The Direct
> format equation converts register Y to physical X using
> X = (Y * 10^-R - b) / m. With m = 64, b = 0, and R = 1, the effective LSB is
> 10^-1 / 64 = 1.5625 mV/LSB.
>
> To match the 6.4 mV/LSB mentioned in the macro comments, would the correct
> coefficients be m = 15625 and R = -2?
My code and comment were not aligned, comments updated for v2.
> [Severity: High]
> Does returning 0 here prevent the PMBus core from automatically unlocking the
> chip? The core initialization code checks PMBUS_WRITE_PROTECT and writes 0 to
> unlock it only if it appears enabled. By faking an unlocked state, the core
> skips the unlock command, which might cause the hardware to silently ignore
> sysfs configuration writes.
ok, shall be fixed for v2
> [Severity: Medium]
> Does this sequence need to hold mps_lock during the NVM register reads? If
> an nvmem read races with a force clear or an NVM store/restore operation, it
> might hit an undocumented NVM-busy window, resulting in NACKs and silently
> returning zero-filled snapshot data.
ok, shall be fixed for v2
> [Severity: Medium]
> Does this code leak the dentry reference returned by debugfs_lookup()? If the
> directory already exists, debugfs_lookup() returns it with an incremented
> reference count, which requires a matching dput() to prevent a memory leak.
ok, shall be fixed for v2
> [Severity: Medium]
> Does this unconditionally reschedule the worker even when an IRQ is already
> configured? If client->irq is present, taking the goto rearm path will cause
> the worker to perpetually wake up and reschedule itself without performing
> any checks.
ok, shall be fixed for v2
> [Severity: High]
> Can this early return cause a use-after-free in debugfs?
>
> Since mpq8646_debugfs_register() has already created files referencing the
> devm_kzalloc-allocated priv struct, returning -EINVAL here leaves dangling
> dentry files. If these files are read later, they will dereference the freed
> priv structure. Should mpq8646_debugfs_unregister() be called before
> returning?
ok, shall be fixed for v2
Best regards,
Vincent
> Sashiko AI review · https://sashiko.dev/#/patchset/20260723-mpq8646_v0-v1-0-14363c75916f@free.fr?part=3
prev parent reply other threads:[~2026-07-23 14:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 13:02 [PATCH 0/3] hwmon: pmbus: add MPS MPQ8646 support Vincent Jardin via B4 Relay
2026-07-23 13:02 ` [PATCH 1/3] hwmon: pmbus: event notification with alarms Vincent Jardin via B4 Relay
2026-07-23 13:13 ` sashiko-bot
2026-07-23 14:28 ` Vincent Jardin
2026-07-23 15:15 ` Vincent Jardin
2026-07-23 13:02 ` [PATCH 2/3] dt-bindings: hwmon: pmbus: add MPS MPQ8646 binding Vincent Jardin via B4 Relay
2026-07-23 13:10 ` sashiko-bot
2026-07-23 14:30 ` Vincent Jardin
2026-07-23 13:02 ` [PATCH 3/3] hwmon: pmbus: add MPQ8646 driver Vincent Jardin via B4 Relay
2026-07-23 13:19 ` sashiko-bot
2026-07-23 14:42 ` Vincent Jardin [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=amIocoxA_omNKz-I@L30177.local \
--to=vjardin@free.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox