From: sashiko-bot@kernel.org
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: wsa+renesas@sang-engineering.com, robh@kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v5 10/10] net: ethernet: ravb: Add gPTP support for Gen4
Date: Tue, 22 Sep 2026 17:51:40 +0000 [thread overview]
Message-ID: <20260922175140.8578D1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260921175037.4084310-11-niklas.soderlund+renesas@ragnatech.se>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: ravb: reference leak of of_gptp device node on probe failure
--
commit b1512d2d01596b4db2e1647ebacba3babfa69468
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
net: ethernet: ravb: Add gPTP support for Gen4
This commit utilizes the refactoring of the RAVB gPTP code to add support
for a system-wide clock on Gen4 devices. It adds ravb_gen4_ptp_probe()
which parses the ptp-timer property and stores the device node reference.
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index ea1c7e536791e..5a07cc0180d8b 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
[ ... ]
> @@ -2973,12 +3067,10 @@ static int ravb_probe(struct platform_device *pdev)
> goto out_reset_assert;
> }
>
> - if (info->gptp_ref_clk) {
> - priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp");
> - if (IS_ERR(priv->gptp_clk)) {
> - error = PTR_ERR(priv->gptp_clk);
> + if (info->ptp && info->ptp->probe) {
> + error = info->ptp->probe(ndev);
> + if (error)
> goto out_reset_assert;
> - }
> }
>
> priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk");
[Severity: Medium]
Does this code leak the device node reference on probe failure?
When info->ptp->probe() succeeds, ravb_gen4_ptp_probe() acquires a reference
to the ptp-timer node via of_parse_phandle() and stores it in priv->of_gptp.
If a subsequent initialization step in ravb_probe() fails (for example,
devm_clk_get_optional() or pm_runtime_resume_and_get()), the function jumps to
error labels that return without dropping the reference:
drivers/net/ethernet/renesas/ravb_main.c:ravb_probe() {
...
out_reset_assert:
reset_control_assert(rstc);
out_free_netdev:
free_netdev(ndev);
return error;
}
> @@ -3157,6 +3245,7 @@ static void ravb_remove(struct platform_device *pdev)
> pm_runtime_disable(&pdev->dev);
> pm_runtime_dont_use_autosuspend(dev);
> clk_unprepare(priv->refclk);
> + of_node_put(priv->of_gptp);
> reset_control_assert(priv->rstc);
> free_netdev(ndev);
> platform_set_drvdata(pdev, NULL);
This properly drops the reference during removal, but shouldn't we also
have an of_node_put(priv->of_gptp) in the error path of ravb_probe()
to handle cold probe failures?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260921175037.4084310-1-niklas.soderlund+renesas@ragnatech.se?part=10
next prev parent reply other threads:[~2026-09-22 17:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 17:50 [PATCH net-next v5 00/10] ravb: Add gPTP support for Gen4 Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 01/10] net: ethernet: ravb: Remove gPTP control from WoL setup and restore Niklas Söderlund
2026-09-22 17:51 ` sashiko-bot
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 02/10] net: ethernet: ravb: Move programming of gPTP timer interval Niklas Söderlund
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 03/10] net: ethernet: ravb: Simplify gPTP start and stop Niklas Söderlund
2026-09-22 17:51 ` sashiko-bot
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 04/10] net: ethernet: ravb: Remove redundant argument to ravb_ptp_init() Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 05/10] net: ethernet: ravb: Propagate error from ptp_clock_register() Niklas Söderlund
2026-09-22 17:51 ` sashiko-bot
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 06/10] net: ethernet: ravb: Replace gPTP flags with callbacks Niklas Söderlund
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 07/10] net: ethernet: ravb: Add callback for gPTP probe Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 08/10] net: ethernet: ravb: Add callback for gPTP clock index Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 09/10] dt-bindings: net: renesas,etheravb: Add optional gPTP phandle for Gen4 Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 10/10] net: ethernet: ravb: Add gPTP support " Niklas Söderlund
2026-09-22 17:51 ` sashiko-bot [this message]
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-25 23:45 ` [PATCH net-next v5 00/10] " Jakub Kicinski
2026-09-25 23:50 ` patchwork-bot+netdevbpf
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=20260922175140.8578D1F000FF@smtp.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