[PATCH] usb: dwc3: core: Use IS_ERR_VALUE() for ref_clk rate check

Tom Rini trini at konsulko.com
Mon Feb 9 23:53:32 CET 2026


On Mon, Feb 09, 2026 at 10:46:03PM +0100, Marek Vasut wrote:
> On 2/9/26 9:51 PM, Tom Rini wrote:
> > On Mon, Feb 09, 2026 at 09:35:54PM +0100, Marek Vasut wrote:
> > > On 2/9/26 9:14 PM, Jonas Karlman wrote:
> > > > clk_get_rate() in U-Boot is documented to return clock rate on success,
> > > > 0 for invalid clock and -ve error code for other errors. This differ
> > > > slightly from Linux where only >= 0 is returned from clk_get_rate().
> > > > 
> > > > Some clock drivers take advantage of this difference and may return -ve
> > > > error code for clocks not fully supported in U-Boot.
> > > > 
> > > > Use IS_ERR_VALUE() to check for an error code in addition to current
> > > > invalid clock check to fix broken and unpredicted behavior when clock
> > > > driver returns a -ve error code for the ref_clk.
> > > > 
> > > > Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> > > I wonder if it would be better to fix the API discrepancy . Could you try
> > > that instead ?
> > 
> > Which API discrepancy? clk_get_rate behaves the way it behaves
> > intentionally and there's some fairly long and recent threads about that
> > resulting from attepmts to change that.
> Align clk_get_rate() between U-Boot and Linux kind of discrepancy .

That's not in the current list of options. Please look at the various
threads in the past 6-8 months (and some reverts about series that tried
this). That was my initial opinion too, FWIW.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260209/18a2403a/attachment.sig>


More information about the U-Boot mailing list