usb: gadget: xilinx: fix devm_ioremap_resource() check

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>
This commit is contained in:
Vladimir Zapolskiy 2015-03-29 05:43:22 +03:00 committed by Felipe Balbi
parent 2283219040
commit 49bce159fb

View File

@ -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) {