Skip to content

Commit

Permalink
usb: gadget: xilinx: fix devm_ioremap_resource() check
Browse files Browse the repository at this point in the history
devm_ioremap_resource() returns IOMEM_ERR_PTR() and it never
returns NULL, fix the check to prevent access to invalid
virtual address.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
vzapolskiy authored and Felipe Balbi committed Apr 27, 2015
1 parent 2283219 commit 49bce15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/udc/udc-xilinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2071,8 +2071,8 @@ static int xudc_probe(struct platform_device *pdev)
/* Map the registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
udc->addr = devm_ioremap_resource(&pdev->dev, res);
if (!udc->addr)
return -ENOMEM;
if (IS_ERR(udc->addr))
return PTR_ERR(udc->addr);

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
Expand Down

0 comments on commit 49bce15

Please sign in to comment.