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

Sergey Shtylyov sergei.shtylyov at gmail.com
Sun Mar 1 08:37:02 PST 2026


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 at qq.com>
> ---
>  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




More information about the linux-arm-kernel mailing list