Skip to content

Commit

Permalink
usb: gadget: udc: lpc32xx: fix return value check in lpc32xx_udc_probe()
Browse files Browse the repository at this point in the history
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: 408b56c ("usb: gadget: udc: lpc32xx: simplify probe")
Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Wei Yongjun authored and Felipe Balbi committed Jun 6, 2019
1 parent 066cfd0 commit 42cc688
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/udc/lpc32xx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3069,9 +3069,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 */
Expand Down

0 comments on commit 42cc688

Please sign in to comment.