[PATCH v14 04/38] phy: rockchip: usbdp: Fix devm_clk_bulk_get_all check

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Aug 13 18:41:36 PDT 2026


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

Pre-existing issues:
- [High] Missing NULL check on `udphy->clks[i].id` before passing to `strncmp`.
--

--- Patch [4]: [PATCH v14 04/38] phy: rockchip: usbdp: Fix devm_clk_bulk_get_all check ---
commit 744151abc279ab01b34daf0e77ee2a3dbe3ad834
Author: Sebastian Reichel <sebastian.reichel at collabora.com>

phy: rockchip: usbdp: Fix devm_clk_bulk_get_all check

This commit changes the error handling for devm_clk_bulk_get_all() to
properly return its error code, such as -EPROBE_DEFER, rather than masking
it with -ENODEV. The change allows the driver to defer probing when
necessary. Missing clocks are now handled by the subsequent refclk search
check.

Closes: https://lore.kernel.org/linux-phy/20260612164107.C7DB21F000E9@smtp.kernel.org/

> diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> @@ -427,8 +427,8 @@ static int rk_udphy_clk_init(struct rk_udphy *udphy, struct device *dev)
>  	int i;
>  
>  	udphy->num_clks = devm_clk_bulk_get_all(dev, &udphy->clks);
> -	if (udphy->num_clks < 1)
> -		return -ENODEV;
> +	if (udphy->num_clks < 0)
> +		return udphy->num_clks;
>  
>  	/* used for configure phy reference clock frequency */
>  	for (i = 0; i < udphy->num_clks; i++) {
>  		if (!udphy->clks[i].id)
>  			continue;
>  
>  		if (!strncmp(udphy->clks[i].id, "refclk", 6)) {

[Severity: High]
This is a pre-existing issue, but can this lead to a NULL pointer
dereference in rk_udphy_clk_init()?

If a device tree defines the clocks property but omits the clock-names
property, devm_clk_bulk_get_all() returns a positive clock count but
initializes clks[i].id to NULL.

Does this loop unconditionally pass that NULL pointer to strncmp(),
resulting in a kernel panic during probe?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813-rockchip-usbdp-cleanup-v14-0-b5ad9c68fa11@collabora.com?part=4



More information about the linux-phy mailing list