Re: [PATCH] USB: pxa27x_udc: check return value of clk_enable

From: Sergey Shtylyov

Date: Sun Mar 01 2026 - 11:37:19 EST


On 3/1/26 7:23 PM, Zhaoyang Yu wrote:

> clk_enable() may fail according to the API contract.
> Previously, udc_enable() ignored its return value.
> This patch checks the return value and logs an error
> without continuing initialization if clk_enable fails.
>
> Signed-off-by: Zhaoyang Yu <2426767509@xxxxxx>
> ---
> drivers/usb/gadget/udc/pxa27x_udc.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
> index 897f53601b5b..69fcecaf6061 100644
> --- a/drivers/usb/gadget/udc/pxa27x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa27x_udc.c
> @@ -1696,7 +1696,13 @@ static void udc_enable(struct pxa_udc *udc)
> if (udc->enabled)
> return;
>
> - clk_enable(udc->clk);
> + int ret;

Please don't declare variables amidst of a function. IIRC, the Linux coding
style doesn't allow for this C++-ism...

[...]

MBR, Sergey