From: sashiko-bot@kernel.org
To: "Ali Rouhi" <arouhi@sitime.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v12 05/12] dpll: sit9531x: register DPLL devices and pins
Date: Sat, 10 Oct 2026 18:32:08 +0000 [thread overview]
Message-ID: <sashiko-outbox-166807@kernel.org> (raw)
In-Reply-To: <20261009183151.78497-6-arouhi@sitime.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] locking: Missing multiop_lock in sit9531x_dev_state_fetch() violating function contracts
- [Low] build: Use of undefined kzalloc_obj macro causes compilation failure
--
commit 07998476897b60ae6e981144b634fb6008fd348c
Author: Oleg Zadorozhnyi <Oleg.Zadorozhnyi@devoxsoftware.com>
dpll: sit9531x: register DPLL devices and pins
This commit registers each of the four on-chip PLLs as a DPLL device and
exposes their respective input and output clocks as DPLL pins. It adds
initialization for the device hardware state, pin ops mapping, and a
periodic kthread worker to poll hardware status and notify the core of
changes.
> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c
[ ... ]
> static int sit9531x_dev_state_fetch(struct sit9531x_dev *sitdev)
> {
[ ... ]
> /*
> * The priority-table read walks the Page-1 registers, so it runs
> * with multiop_lock held like every other multi-register sequence.
> * Nothing can race with it here -- the DPLLs are not registered and
> * the monitor is not running yet -- but the page handling stays
> * serialized the same way as at runtime.
> */
> mutex_lock(&sitdev->multiop_lock);
> rc = sit9531x_ref_pll_mask_fetch(sitdev);
> mutex_unlock(&sitdev->multiop_lock);
> if (rc) {
> dev_err(sitdev->dev,
> "Failed to fetch input priority tables: %d\n", rc);
> return rc;
> }
>
> for (i = 0; i < sitdev->info->num_outputs; i++) {
> rc = sit9531x_out_state_fetch(sitdev, i);
[Severity: Low]
Does this code violate the internal locking contract?
The function sit9531x_out_state_fetch() calls sit9531x_output_mode_fetch(),
which documents that the caller must hold sitdev->multiop_lock because it
accesses multiple paged registers. While this is called during probe when
concurrent threads might not be active yet, the lock is explicitly dropped
just before this loop.
> if (rc) {
> dev_err(sitdev->dev,
> "Failed to fetch output %u state: %d\n", i, rc);
> return rc;
> }
> }
>
> for (i = 0; i < SIT9531X_NUM_PLLS; i++) {
> rc = sit9531x_chan_state_fetch(sitdev, i);
[Severity: Low]
Can this lead to paged register desynchronization?
Similarly, sit9531x_chan_state_fetch() calls sit9531x_prio_table_read(),
which also requires multiop_lock to serialize page accesses. Dropping the
lock before these state fetches breaks the driver's documented concurrency
model for register pages.
> if (rc) {
> dev_err(sitdev->dev,
> "Failed to fetch PLL%c state: %d\n",
> 'A' + i, rc);
> return rc;
> }
> }
>
> return 0;
> }
[ ... ]
> static struct sit9531x_dpll_pin *
> sit9531x_dpll_pin_alloc(struct sit9531x_dpll *sitdpll,
> enum dpll_pin_direction dir, u8 id)
> {
> struct sit9531x_dpll_pin *pin;
>
> pin = kzalloc_obj(*pin, GFP_KERNEL);
[Severity: Low]
Will this compile successfully?
The kzalloc_obj macro used here receives two arguments. However,
kzalloc_obj is not a standard kernel macro (the standard is kzalloc), and
where it is used internally in the DPLL core, it only takes a single
argument. This looks like a syntax error that will fail to build. Should
this use kzalloc() instead?
> if (!pin)
> return ERR_PTR(-ENOMEM);
>
> pin->dpll = sitdpll;
> pin->dir = dir;
> pin->id = id;
>
> return pin;
> }
[ ... ]
> struct sit9531x_dpll *sit9531x_dpll_alloc(struct sit9531x_dev *sitdev, u8 ch)
> {
> struct sit9531x_dpll *sitdpll;
>
> sitdpll = kzalloc_obj(*sitdpll, GFP_KERNEL);
[Severity: Low]
The same compilation issue with kzalloc_obj() appears here.
> if (!sitdpll)
> return ERR_PTR(-ENOMEM);
>
> sitdpll->dev = sitdev;
> sitdpll->id = ch;
> sitdpll->lock_status = DPLL_LOCK_STATUS_UNLOCKED;
> sitdpll->lock_status_error = DPLL_LOCK_STATUS_ERROR_NONE;
> INIT_LIST_HEAD(&sitdpll->pins);
>
> return sitdpll;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009183151.78497-1-arouhi@sitime.com?part=5
next prev parent reply other threads:[~2026-10-10 18:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 18:31 [PATCH net-next v12 00/12] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-10-09 18:31 ` [PATCH net-next v12 02/12] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-10-09 18:31 ` [PATCH net-next v12 01/12] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-10-09 18:31 ` [PATCH net-next v12 03/12] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-10-10 18:32 ` sashiko-bot
2026-10-09 18:31 ` [PATCH net-next v12 05/12] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-10-10 18:32 ` sashiko-bot [this message]
2026-10-09 18:31 ` [PATCH net-next v12 04/12] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-10-09 18:31 ` [PATCH net-next v12 06/12] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-10-09 18:31 ` [PATCH net-next v12 07/12] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-10-09 18:31 ` [PATCH net-next v12 08/12] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-10-10 18:32 ` sashiko-bot
2026-10-09 18:31 ` [PATCH net-next v12 09/12] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-10-09 18:31 ` [PATCH net-next v12 10/12] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-10-09 18:31 ` [PATCH net-next v12 11/12] dpll: sit9531x: add support to get phase offset on the connected input pin Ali Rouhi
2026-10-09 18:32 ` [PATCH net-next v12 12/12] dpll: sit9531x: model the inter-PLL sync net as a pair of pins Ali Rouhi
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=sashiko-outbox-166807@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arouhi@sitime.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@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