Hi Wei Yongjun,

On 05/04/2019 10:04 AM, Wei Yongjun wrote:
> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
> 
> This issue was detected by using the Coccinelle software.
> 
> Fixes: 408b56ca5c8e ("usb: gadget: udc: lpc32xx: simplify probe")
> Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
> ---
>  drivers/usb/gadget/udc/lpc32xx_udc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c 
> b/drivers/usb/gadget/udc/lpc32xx_udc.c
> index d8f1c60793ed..00fb79c6d025 100644
> --- a/drivers/usb/gadget/udc/lpc32xx_udc.c
> +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
> @@ -3070,9 +3070,9 @@ static int lpc32xx_udc_probe(struct platform_device 
> *pdev)
>       }
>  
>       udc->udp_baseaddr = devm_ioremap_resource(dev, res);
> -     if (!udc->udp_baseaddr) {
> +     if (IS_ERR(udc->udp_baseaddr)) {
>               dev_err(udc->dev, "IO map failure\n");
> -             return -ENOMEM;
> +             return PTR_ERR(udc->udp_baseaddr);
>       }
>  
>       /* Get USB device clock */

thank you for the change, it is a correct fix.

I do suppose that dev_err() in the context can be evenly removed, but
likely it should be another change.

Acked-by: Vladimir Zapolskiy <v...@mleia.com>

--
Best wishes,
Vladimir

Reply via email to