Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: linux-sunxi@lists.linux.dev, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v9 3/5] pwm: sun8i: export the bypass outputs as clocks
Date: Tue, 22 Sep 2026 00:18:40 +0000	[thread overview]
Message-ID: <20260922001841.0899F1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260921-h616-pwm-v8-v9-3-37bec6201ff5@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] clk: missing args_count validation in sun8i_pwm_get_clk_hw() reads uninitialized memory
--

commit 68e6d29bee94ba15c085b933d17a7299032ead6b
Author: Richard Genoud <richard.genoud@bootlin.com>

pwm: sun8i: export the bypass outputs as clocks

This commit exposes each H616 PWM channel's hardware bypass as a CCF clock
for consumers that need a clock rather than PWM duty control. It arbitrates
ownership between PWM requests and clock prepare, using CLK_IGNORE_UNUSED
to preserve unclaimed bypass outputs.

> diff --git a/drivers/pwm/pwm-sun8i.c b/drivers/pwm/pwm-sun8i.c
> index 7e6c39815c183..fd81c5f5e3267 100644
> --- a/drivers/pwm/pwm-sun8i.c
> +++ b/drivers/pwm/pwm-sun8i.c

[ ... ]

> @@ -1012,6 +1169,17 @@ sun8i_pwm_sanitize_disabled_pairs(struct sun8i_pwm_chip *sun8i_chip)
>  	sun8i_pwm_writel(sun8i_chip, per, SUN8I_PWM_PER);
>  }
>  
> +static struct clk_hw *sun8i_pwm_get_clk_hw(struct of_phandle_args *clkspec,
> +					   void *data)
> +{
> +	struct sun8i_pwm_chip *sun8i_chip = data;
> +
> +	if (clkspec->args[0] >= SUN8I_PWM_NPWM)

[Severity: Medium]
Is it possible to read uninitialized memory here if the device tree is
incorrectly configured? 

If a consumer device requests a clock from this provider but specifies zero
clock cells (#clock-cells = <0>), of_parse_phandle_with_args() might leave
the args array uninitialized.

Should this code verify clkspec->args_count >= 1 before accessing
clkspec->args[0]?

> +		return ERR_PTR(-EINVAL);
> +
> +	return &sun8i_chip->channels[clkspec->args[0]].bypass_hw;
> +}
> +
>  static int sun8i_pwm_probe(struct platform_device *pdev)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921-h616-pwm-v8-v9-0-37bec6201ff5@gmail.com?part=3

  reply	other threads:[~2026-09-22  0:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  0:06 [PATCH v9 0/5] Introduce Allwinner H616 PWM controller James Hilliard
2026-09-22  0:06 ` [PATCH v9 1/5] dt-bindings: pwm: allwinner: add h616 pwm compatible James Hilliard
2026-09-22  0:06 ` [PATCH v9 2/5] pwm: sun8i: Add H616 PWM support James Hilliard
2026-09-22  0:16   ` sashiko-bot
2026-09-22  0:06 ` [PATCH v9 3/5] pwm: sun8i: export the bypass outputs as clocks James Hilliard
2026-09-22  0:18   ` sashiko-bot [this message]
2026-09-22  0:06 ` [PATCH v9 4/5] arm64: dts: allwinner: h616: add PWM controller James Hilliard
2026-09-22  0:06 ` [PATCH v9 5/5] MAINTAINERS: Add entry on Allwinner sun8i/H616 PWM driver James Hilliard

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=20260922001841.0899F1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --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