Re: [PATCH v14 04/38] phy: rockchip: usbdp: Fix devm_clk_bulk_get_all check
| Newsgroups | org.infradead.lists.linux-phy,org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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/[email protected]/ > 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/[email protected]?part=4 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy