From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796405955; b=aZnWE8V0GOGjH2IECPUcuzHuZXFG6STSB0W7qGET337qdZyiWHXGXXyBEye6P1dDQIxV KT2BEvEX0WviY9TDibNMm66Ab6IS5wgV/rCIz+sdmbnUD9HB0zbfG8W9rUI5QEMA0aInB nzn5J147exgAFQ8od+o08Gh9TaeijQvx/4Mc6RfI0qyrcbsCocE7LK+pgABm0rgZaBYIU kNeEx5nlswm2FnRaHaozvgPq7LP1VV00YqUZAmrksZVOauD1UZoBZqtE73HBeytfjGrbz Qk4NyASJJv3GZqlRGgpN2GqbqsnLCh5WNIrIKdWADJl9/nCSiY+koBzD8NXXwS8JN/w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796405955; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=c73jSv+Ca4ie5A74ZvoUfETk7Nxw7mDiMfVsFJ6CuG8=; b=OXOnISL2Us1QvsHr9EOCXxMFiENMsi9neQvJUoRL1tydHtGJt3+7Tk4JKbrUa/zGzffL G0hG55nocVHT87Ro22L82JsBHV/P63j/5TZYOnxmhn8ivrUA7APaCcn2giQZsKr0RrbGa bDVzjaA6TdZ77yFkg/DHPnqbXagyVTs8IlPG0374BCLBhLO/Aa6hg7FW1arcaw8M3dGUb 0kYA09hjXngtwIP3tyOuesqnAZdRgFxjQ5us5Eh4buIqG/f6SFYztX7upVDF/r/UcvPxT 39wzQd4xZD6e+5iYVcRRJfe66NWZgLoLkuCaPUxQN1ETDvW2TIz6jmCSN1qWtu2OLPA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=N74URSAa; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735C4606A322; Fri, 4 Dec 2026 17:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=N74URSAa Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0E1A1F00936; Fri, 4 Dec 2026 17:39:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796405955; bh=c73jSv+Ca4ie5A74ZvoUfETk7Nxw7mDiMfVsFJ6CuG8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=N74URSAaOef0QVKBdCH2J4QSFW6E11CaRGgdhRTvTJJZ5qfirWxf8WXknipi/KH0w /JdobQSAl6awwWvg80KrMyfJInAzgj4KphWHc0pEUE/z8J+v5YQ+UcYHI6ixNoNzdR 1CmHBpNAvUTu47ExgbYsePUhROssk+BjH5gd1eGcCrkzXHf8xMg8zNgKrtSjja5jmZ UJQQ7GTrDu7VOVVM2Lxs8YjabD0EHScLDChfntWSyVaBjrINdqMCGxlCASINPvzPLK sCXelzCscXlG653WMmM/E52/UF7SSX4eKIDjVSzLggv/GgmYp0M1oFl5Nvj8Is3hBo i/gAJL6/YMnhg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 10/13] clk: berlin: add Synaptics SL2610 clocks and PLLs Reply-To: sashiko-reviews@lists.linux.dev To: "Jisheng Zhang" Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, mfd@lists.linux.dev, robh@kernel.org, conor+dt@kernel.org, lee@kernel.org In-Reply-To: <20261204140732.31223-11-jszhang@kernel.org> References: <20261204140732.31223-1-jszhang@kernel.org> <20261204140732.31223-11-jszhang@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 17:39:14 +0000 X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 8 potential issues to consider: - [Medium] clk: berlin: hardcoded osc parent breaks ge0 and ge1 ptp refclks - [Medium] clk: berlin: IRQ-unsafe sl_sysmgr_gateclk_lock risks hardirq deadlock - [Medium] clk: berlin: external clk_hw stored in clk_parent_data.hw - [Medium] clk: berlin: unchecked platform_get_device_id() in sl2610_clks_probe() - [Low] clk: berlin: misspelled gate clock names apbuart3lck and apbi2c1lck - [Low] clk: berlin: unused SL2610_APLL macro and struct forward declarations - [Low] clk: berlin: ARCH_BERLIN gate in drivers/clk/Makefile breaks COMPILE_TEST - [Low] clk: berlin: dereference of dev before NULL check in sl2610_pll_register() -- commit b1f80cb9b6c334b2a4faa23585bae12adc210391 Author: Jisheng Zhang clk: berlin: add Synaptics SL2610 clocks and PLLs This commit adds the Synaptics SL2610 PLL and clock controller drivers, registering the SoC, CPU, AVIO, and MCU clocks via MFD platform devices. > diff --git a/drivers/clk/berlin/Kconfig b/drivers/clk/berlin/Kconfig > index 8f71d4c7a478b..88760ad0af5b9 100644 > --- a/drivers/clk/berlin/Kconfig > +++ b/drivers/clk/berlin/Kconfig > @@ -5,3 +5,29 @@ config SL_COMMON_CLK > =20 > config SL_SYSMGR_CLK > bool > + > +config SL2610_PLL > + tristate "Synaptics SL2610 PLL Driver" > + depends on ARCH_BERLIN || COMPILE_TEST > + default n > + help > + Support the integer and fractional PLL outputs used by the SoC, > + CPU and audio clock controllers on Synaptics SL2610 SoCs. > + > + To compile this driver as a module, choose M here. The module will > + be called sl2610-pll. > + > +config SL2610_CLK > + tristate "Synaptics SL2610 Clock Driver" > + depends on ARCH_BERLIN || COMPILE_TEST > + depends on OF && HAS_IOMEM [Severity: Low] Will SL2610_PLL and SL2610_CLK actually be built when COMPILE_TEST is enabled without ARCH_BERLIN? drivers/clk/Makefile still gates descent into the directory on obj-$(CONFIG_ARCH_BERLIN) +=3D berlin/, so Kbuild silently skips drivers/clk/berlin/ when ARCH_BERLIN is disabled. Switching that entry to obj-y +=3D berlin/ would also require gating the unconditional berlin2-*.o objects in drivers/clk/berlin/Makefile. > diff --git a/drivers/clk/berlin/clk-sl2610.c b/drivers/clk/berlin/clk-sl2= 610.c > new file mode 100644 > index 0000000000000..b51d3523028de > --- /dev/null > +++ b/drivers/clk/berlin/clk-sl2610.c [ ... ] > + { "apbuart3lck", "apbcoreclk", CLK_APBUART3, 13 }, > + { "apbi2c0clk", "apbcoreclk", CLK_APBI2C0, 14 }, > + { "apbi2c1lck", "apbcoreclk", CLK_APBI2C1, 15 }, [Severity: Low] apbuart3lck and apbi2c1lck appear to be typos for apbuart3clk and apbi2c1clk, which exposes misspelled names in debugfs and breaks any name-based lookup for those clocks. [ ... ] > +static const char * const ge_ptp_refclk_parent_names[] =3D { > + "osc", > + "apll0_outf", > + "syspll1_out", > + "syspll0_out", > + "clk_mcu_axi", > +}; [Severity: Medium] Can ge0_ptp_refclk and ge1_ptp_refclk end up orphaned at 0 Hz when parent index 0 is selected? The DT binding passes the external reference clock by phandle without requiring it to be globally named "osc". In sl2611.dtsi, the fixed-clock node is named clock-osc without clock-output-names, so _of_fixed_clk_setup() registers it as "clock-osc" rather than "osc". Resolving the reference clock from dev->parent->of_node or using clk_parent_data would avoid the mismatch. [ ... ] > +static int sl2610_sysmgr_clk_setup(struct platform_device *pdev) > +{ > + return sl_sysmgr_clk_setup(pdev, sl2610_sysmgr_fixeds, ARRAY_SIZE(sl261= 0_sysmgr_fixeds), > + sl2610_sysmgr_gates, ARRAY_SIZE(sl2610_sysmgr_gates), > + CLK_GATE_CTRL0, > + sl2610_sysmgr_clks, ARRAY_SIZE(sl2610_sysmgr_clks)); > +} [Severity: Medium] Can registering these MCU gate clocks trigger a hardirq deadlock on sl_sysmgr_gateclk_lock? In drivers/clk/berlin/sl-sysmgr-clk.c, both sl_sysmgr_gateclk_enable() and sl_sysmgr_gateclk_is_enabled() acquire sl_sysmgr_gateclk_lock with plain guard(spinlock) without disabling interrupts. Reading /sys/kernel/debug/clk/clk_summary calls sl_sysmgr_gateclk_is_enabled() in process context with IRQs enabled, which can deadlock if a hardirq enables a gate clock on the same CPU: clk_summary_show_one() clk_core_is_enabled() sl_sysmgr_gateclk_is_enabled() guard(spinlock)(&sl_sysmgr_gateclk_lock) clk_enable() sl_sysmgr_gateclk_enable() guard(spinlock)(&sl_sysmgr_gateclk_lock) <-- spins forever It also creates an ABBA lock inversion with CCF's global enable_lock across CPUs. Using guard(spinlock_irqsave) in sl_sysmgr_gateclk_enable() (and either guard(spinlock_irqsave) or a lockless readl_relaxed() in sl_sysmgr_gateclk_is_enabled()) avoids the inversion. [ ... ] > +static int sl2610_clks_probe(struct platform_device *pdev) > +{ > + int (*clk_setup)(struct platform_device *pdev); > + > + clk_setup =3D (void *)platform_get_device_id(pdev)->driver_data; > + > + return clk_setup(pdev); > +} [Severity: Medium] Can platform_get_device_id(pdev) return NULL and cause a NULL pointer dereference here? If an unbound platform device is bound to sl2610-clk via sysfs driver_override, platform_match() returns early on device_match_driver_override() without calling platform_match_id(), leaving pdev->id_entry NULL. Checking for a NULL id and returning -ENODEV prevents the oops. > diff --git a/drivers/clk/berlin/sl2610-pll.c b/drivers/clk/berlin/sl2610-= pll.c > new file mode 100644 > index 0000000000000..62c5d2d19c362 > --- /dev/null > +++ b/drivers/clk/berlin/sl2610-pll.c [ ... ] > +#define SL2610_APLL > +struct sl2610_pll { [Severity: Low] SL2610_APLL is an unused leftover macro. In addition, sl2610-pll.h contains unused forward declarations for struct clk_hw_onecell_data and struct device_node. [ ... ] > +int sl2610_pll_register(struct device *dev, void __iomem *ctrl, > + const char *out, const char *outf) > +{ > + struct device_node *np =3D dev->parent->of_node; > + struct clk_parent_data parent =3D {}; > + struct clk_init_data init =3D {}; > + struct sl2610_pll *pll; > + struct clk *input; > + int ret; > + > + if (!dev || !ctrl || !out || !outf) > + return -EINVAL; [Severity: Low] Does the initializer for np dereference dev before the !dev check? Initializing np after validating dev (and dev->parent and np if defensive checking is intended) avoids the dead NULL check and prevents an oops if a caller ever passes a NULL dev. > + input =3D of_clk_get(np, 0); > + if (IS_ERR(input)) > + return dev_err_probe(dev, PTR_ERR(input), > + "failed to get PLL reference clock\n"); > + parent.hw =3D __clk_get_hw(input); > + ret =3D devm_add_action_or_reset(dev, sl2610_pll_put_clk, input); > + if (ret) > + return ret; > + > + pll =3D devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); > + if (!pll) > + return -ENOMEM; > + pll->ctrl =3D ctrl; > + > + init.name =3D out; > + init.ops =3D &sl2610_pllout_ops; > + init.parent_data =3D &parent; > + init.num_parents =3D 1; > + init.flags =3D CLK_GET_RATE_NOCACHE; > + pll->pllout.init =3D &init; > + > + ret =3D devm_clk_hw_register(dev, &pll->pllout); [Severity: Medium] Can storing __clk_get_hw(input) in parent.hw cause a use-after-free if the external reference clock provider is unregistered? clk_parent_data.hw is only valid for provider-internal clocks, and holding the struct clk from of_clk_get() does not prevent an external provider from unregistering and freeing its struct clk_hw. On unregistration, clk_core_evict_parent_cache() clears entry->core while leaving entry->hw set, so a later clk_core_fill_parent_index() dereferences entry->hw->core on the freed clk_hw. Since clk_hw_register() already attaches dev->parent->of_node, initializing parent with { .index =3D 0 } lets CCF resolve the DT parent directly without of_clk_get() or storing an external clk_hw pointer. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204140732.3122= 3-1-jszhang@kernel.org?part=3D10