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

Greg KH gregkh at linuxfoundation.org
Wed Mar 11 05:49:58 PDT 2026


On Sun, Mar 01, 2026 at 04:55:53PM +0000, 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..006d6d0a5f9a 100644
> --- a/drivers/usb/gadget/udc/pxa27x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa27x_udc.c
> @@ -1693,10 +1693,16 @@ static void udc_init_data(struct pxa_udc *dev)
>   */
>  static void udc_enable(struct pxa_udc *udc)
>  {
> +	int ret;
> +
>  	if (udc->enabled)
>  		return;
>  
> -	clk_enable(udc->clk);
> +	ret = clk_enable(udc->clk);
> +	if (ret) {
> +		dev_err(udc->dev, "clk_enable failed: %d\n", ret);
> +		return;
> +	}

If this can fail, it should return an error to the caller and it should
be handled properly there.

Also, this is a v2 patch, but you did not label it as such :(

thanks,

greg k-h



More information about the linux-arm-kernel mailing list