Re: [PATCH] usb: r8a66597-hcd: Fix clock leak and unchecked clk_prepare_enable()
From: Xiangwu Lai
Date: Tue Nov 17 2026 - 05:06:03 EST
Hi Greg,
sorry, my previous reply was missing the quoted context. Let me
try again.
On Mon, Nov 16, 2026 at 10:34:15AM +0100, Greg Kroah-Hartman wrote:
> And are you hitting this in a real system, or is this just a theoretical
> issue?
That was about this patch of mine:
usb: r8a66597-hcd: Fix clock leak and unchecked clk_prepare_enable()
https://lore.kernel.org/all/20261102100455.600-1-laixiangwu@xxxxxxxxxxxxxxxxxxxx/
No, I'm not hitting this on a real system. It was found by code
inspection while auditing error paths in USB host drivers, and I
don't have hardware with this controller.
The affected path does have in-tree users: several arch/sh SoC and
board setups (sh7723/sh7366/sh7264/sh7269 and the ecovec24,
ms7724se, kfr2r09 boards) register this driver with on_chip = 1,
and the clock handling only runs for those. It is old SuperH
platform code, so the practical population is small.
The failure it fixes is the driver's own hardware init failure
handling: when the register access poll times out because the
device does not respond, r8a66597_clock_enable() returns -ENXIO
with the clock still prepared and enabled, and the probe cleanup
only does clk_put(), so nothing disables it for the remaining
uptime. The same helper also runs from the resume path, whose
return value is ignored there as well. Not checking
clk_prepare_enable() separately turns a failed clock enable into
a bogus -ENXIO from the unclocked register poll.
I have not seen this reported anywhere, so it is fair to call it
a robustness fix rather than a fix for an observed failure. If
you would like to keep it, I'm happy to note the "found by code
inspection, not observed on hardware" context in the commit
message and/or drop the Fixes tag so it does not go to stable.
If you consider it too theoretical for the tree, dropping the
patch is fine by me.
Best regards,
Xiangwu Lai