Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ryan Brue" <ryanbrue.dev@gmail.com>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH 1/2] clk: mediatek: mt8173: fix the FHCTL DDS mask width
Date: Sat, 12 Sep 2026 06:50:03 +0000	[thread overview]
Message-ID: <20260912065004.463FF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912-mt8173-fix-dds-mask-width-v1-1-3d0c0292c85c@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing platform_set_drvdata() in probe causes a NULL pointer dereference in the remove function.
--

commit 89002485f2d73ae2cb8fc035297e800427c96c19
Author: Ryan Brue <ryanbrue.dev@gmail.com>
Subject: clk: mediatek: mt8173: fix the FHCTL DDS mask width

This commit fixes the FHCTL DDS field mask width for the MT8173's hoppable
PLLs by changing the mask from 22-bit to 21-bit. This resolves a 1000 us
polling timeout issue during rate changes that resulted in a warning and
register dump on every hop.

> diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
> index d7d416172ab35..327240cd34fbe 100644
> --- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
> +++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
> @@ -100,7 +100,7 @@ enum fh_pll_id {
>  			.fh_id = _fhid,					\
>  			.fh_ver = FHCTL_PLLFH_V1,			\
>  			.fhx_offset = _offset,				\
> -			.dds_mask = GENMASK(21, 0),			\
> +			.dds_mask = GENMASK(20, 0),			\
>  			.slope0_value = 0x6003c97,			\
>  			.slope1_value = 0x6003c97,			\
>  			.sfstrx_en = BIT(2),				\

[Severity: High]
This is a pre-existing issue, but while reviewing this file, I noticed a
problem in the probe and remove functions.

In clk_mt8173_apmixed_probe(), the driver successfully returns without saving 
the allocated driver data:

	r = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, clk_data);
	if (r)
		goto unregister_ref2usb;

	return 0;

Later, if the driver is unbound, clk_mt8173_apmixed_remove() attempts to
retrieve this data:

	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);

	of_clk_del_provider(node);
	mtk_clk_unregister_ref2usb_tx(clk_data->hws[CLK_APMIXED_REF2USB_TX]);

Could this cause a NULL pointer dereference when clk_data->hws is accessed,
crashing the system if a privileged user unbinds the driver via sysfs? Should
we add a call to platform_set_drvdata(pdev, clk_data) before the probe
function returns to prevent this?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912-mt8173-fix-dds-mask-width-v1-0-3d0c0292c85c@gmail.com?part=1

  reply	other threads:[~2026-09-12  6:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12  6:40 [PATCH 0/2] clk: mediatek: Fix FHCTL DDS mask widths for mt8173, mt6795 Ryan Brue
2026-09-12  6:40 ` [PATCH 1/2] clk: mediatek: mt8173: fix the FHCTL DDS mask width Ryan Brue
2026-09-12  6:50   ` sashiko-bot [this message]
2026-09-12  6:40 ` [PATCH 2/2] clk: mediatek: mt6795: " Ryan Brue

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=20260912065004.463FF1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=ryanbrue.dev@gmail.com \
    --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