Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH net-next v8 2/3] ptp: Add driver for R-Car Gen4
Date: Wed, 11 Nov 2026 08:10:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-208574@kernel.org> (raw)
In-Reply-To: <20261110080727.2377040-3-niklas.soderlund+renesas@ragnatech.se>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ptp: rcar_gen4: check pm_runtime_resume_and_get() in
  ptp_rcar_gen4_probe()
- [Low] ptp: rcar_gen4: missing PTPTMDC_REG write on error in
  ptp_rcar_gen4_probe()
--

commit 0b281490f8408b05b34c2584004769891977d1ff
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

ptp: Add driver for R-Car Gen4

This commit adds a PTP clock driver for the system-wide gPTP timer found
on Renesas R-Car Gen4 SoCs.

> diff --git a/drivers/ptp/ptp_rcar_gen4.c b/drivers/ptp/ptp_rcar_gen4.c
> new file mode 100644
> index 0000000000000..e82b6c5abc306
> --- /dev/null
> +++ b/drivers/ptp/ptp_rcar_gen4.c

[ ... ]

> +static int ptp_rcar_gen4_probe(struct platform_device *pdev)
> +{

[ ... ]

> +	pm_runtime_enable(dev);
> +	pm_runtime_resume_and_get(dev);

[Severity: Medium]
Should ptp_rcar_gen4_probe() check the return value of
pm_runtime_resume_and_get()?  If runtime resume fails, the device remains
suspended and its usage reference is already dropped, so the following
iowrite32() calls access unclocked registers and a later
pm_runtime_put_sync() in the error or remove path will underflow
dev->power.usage_count.

> +
> +	iowrite32(priv->default_addend, priv->base + PTPTIVC0_REG);
> +	iowrite32(1, priv->base + PTPTMEC_REG);
> +
> +	priv->clock = ptp_clock_register(&priv->info, dev);
> +	if (IS_ERR(priv->clock)) {
> +		pm_runtime_put_sync(dev);
> +		pm_runtime_disable(dev);
> +		return PTR_ERR(priv->clock);
> +	}

[Severity: Low]
Should the ptp_clock_register() error path also write 1 to PTPTMDC_REG as
ptp_rcar_gen4_remove() does?  On R-Car S4 and V4H the gPTP block shares
its module clock with the Ethernet controller, so pm_runtime_put_sync()
does not gate the clock while the Ethernet device is active, leaving the
hardware timer running after a failed probe.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110080727.2377040-1-niklas.soderlund+renesas@ragnatech.se?part=2

  reply	other threads:[~2026-11-11  8:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  8:07 [PATCH net-next v8 0/3] ptp: Add driver for R-Car Gen4 Niklas Söderlund
2026-11-10  8:07 ` [PATCH net-next v8 1/3] dt-bindings: ptp: renesas,rcar-gen4-gptp: Add " Niklas Söderlund
2026-11-10  8:07 ` [PATCH net-next v8 2/3] ptp: Add driver for " Niklas Söderlund
2026-11-11  8:10   ` sashiko-bot [this message]
2026-11-10  8:07 ` [PATCH net-next v8 3/3] arm64: dts: renesas: r8a779g0: Add gPTP node Niklas Söderlund

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-208574@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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