Commit 49bce159 authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Felipe Balbi

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: default avatarVladimir Zapolskiy <vz@mleia.com>
Reviewed-by: default avatarSören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 22832190
...@@ -2071,8 +2071,8 @@ static int xudc_probe(struct platform_device *pdev) ...@@ -2071,8 +2071,8 @@ static int xudc_probe(struct platform_device *pdev)
/* Map the registers */ /* Map the registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
udc->addr = devm_ioremap_resource(&pdev->dev, res); udc->addr = devm_ioremap_resource(&pdev->dev, res);
if (!udc->addr) if (IS_ERR(udc->addr))
return -ENOMEM; return PTR_ERR(udc->addr);
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment