From: sashiko-bot@kernel.org
To: "Rodrigo Alencar via B4 Relay"
<devnull+rodrigo.alencar.analog.com@kernel.org>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v13 10/12] iio: frequency: adf41513: features on frequency change
Date: Sun, 17 May 2026 09:54:55 +0000 [thread overview]
Message-ID: <20260517095455.B368EC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260517-adf41513-iio-driver-v13-10-bb6e134a360f@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The calculated `bleed_value` can exceed the 8-bit maximum of `ADF41513_REG6_BLEED_CURRENT_MSK`, causing silent truncation when written.
--
commit ca2e85652223c6f4917441bebff8f2b7161b211f
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
iio: frequency: adf41513: features on frequency change
Set Bleed current when PFD frequency changes (bleed enabled when in
fractional mode). Set lock detector window size, handling bias and
precision. Add phase resync support, setting clock dividers when
PFD frequency changes.
> diff --git a/drivers/iio/frequency/adf41513.c b/drivers/iio/frequency/adf41513.c
> --- a/drivers/iio/frequency/adf41513.c
> +++ b/drivers/iio/frequency/adf41513.c
[ ... ]
> @@ -579,9 +595,83 @@ static int adf41513_calc_pll_settings(struct adf41513_state *st,
> return 0;
> }
>
> +static void adf41513_set_bleed_val(struct adf41513_state *st)
> +{
> + u32 bleed_value, cp_index;
> +
> + if (st->data.phase_detector_polarity)
> + bleed_value = 90;
> + else
> + bleed_value = 144;
> +
> + cp_index = 1 + FIELD_GET(ADF41513_REG5_CP_CURRENT_MSK,
> + st->regs[ADF41513_REG5]);
> + bleed_value = div64_u64(st->settings.pfd_frequency_uhz * cp_index * bleed_value,
> + 1600ULL * MEGA * MICROHZ_PER_HZ);
> +
> + FIELD_MODIFY(ADF41513_REG6_BLEED_CURRENT_MSK, &st->regs[ADF41513_REG6],
> + bleed_value);
Can bleed_value exceed the 8-bit maximum of ADF41513_REG6_BLEED_CURRENT_MSK?
In Integer-N mode, pfd_frequency_uhz can reach 250 MHz (250e12 uHz). Combined
with a maximum cp_index of 16 and a phase detector polarity base value of 144,
the formula yields 360 ((250e12 * 16 * 144) / 1.6e15).
Since ADF41513_REG6_BLEED_CURRENT_MSK is an 8-bit mask (max value 255),
writing 360 via FIELD_MODIFY silently truncates the value to 104.
While this doesn't cause immediate functional harm because the bleed current
is explicitly disabled in Integer-N mode, should this calculation be clamped
or skipped completely when bleed is disabled to prevent writing a wrapped
value?
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260517-adf41513-iio-driver-v13-0-bb6e134a360f@analog.com?part=10
next prev parent reply other threads:[~2026-05-17 9:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 9:13 [PATCH v13 00/12] ADF41513/ADF41510 PLL frequency synthesizers Rodrigo Alencar via B4 Relay
2026-05-17 9:13 ` [PATCH v13 01/12] dt-bindings: iio: frequency: add adf41513 Rodrigo Alencar via B4 Relay
2026-05-17 9:13 ` [PATCH v13 02/12] iio: kstrtox: add local _parse_integer_limit_init() helper Rodrigo Alencar via B4 Relay
2026-05-17 9:34 ` sashiko-bot
2026-05-17 12:19 ` Rodrigo Alencar
2026-05-17 13:53 ` Jonathan Cameron
2026-05-17 9:13 ` [PATCH v13 03/12] lib: kstrtox: add kstrtoudec64() and kstrtodec64() Rodrigo Alencar via B4 Relay
2026-05-17 9:13 ` [PATCH v13 04/12] lib: test-kstrtox: tests for kstrtodec64() and kstrtoudec64() Rodrigo Alencar via B4 Relay
2026-05-17 9:14 ` [PATCH v13 05/12] lib: math: div64: add div64_s64_rem() Rodrigo Alencar via B4 Relay
2026-05-17 9:14 ` [PATCH v13 06/12] iio: core: add decimal value formatting into 64-bit value Rodrigo Alencar via B4 Relay
2026-05-17 10:16 ` Andy Shevchenko
2026-05-17 10:44 ` Rodrigo Alencar
2026-05-17 9:14 ` [PATCH v13 07/12] iio: test: iio-test-format: add test case for decimal format Rodrigo Alencar via B4 Relay
2026-05-17 9:30 ` sashiko-bot
2026-05-17 13:56 ` Jonathan Cameron
2026-05-17 9:14 ` [PATCH v13 08/12] iio: frequency: adf41513: driver implementation Rodrigo Alencar via B4 Relay
2026-05-17 9:49 ` sashiko-bot
2026-05-17 11:56 ` Rodrigo Alencar
2026-05-17 14:05 ` Jonathan Cameron
2026-05-17 9:14 ` [PATCH v13 09/12] iio: frequency: adf41513: handle LE synchronization feature Rodrigo Alencar via B4 Relay
2026-05-17 9:14 ` [PATCH v13 10/12] iio: frequency: adf41513: features on frequency change Rodrigo Alencar via B4 Relay
2026-05-17 9:54 ` sashiko-bot [this message]
2026-05-17 9:14 ` [PATCH v13 11/12] docs: iio: add documentation for adf41513 driver Rodrigo Alencar via B4 Relay
2026-05-17 9:14 ` [PATCH v13 12/12] Documentation: ABI: testing: add common ABI file for iio/frequency Rodrigo Alencar via B4 Relay
2026-05-17 14:08 ` [PATCH v13 00/12] ADF41513/ADF41510 PLL frequency synthesizers Jonathan Cameron
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=20260517095455.B368EC2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+rodrigo.alencar.analog.com@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