host: uhci-platform: fix NULL pointer dereference on resource

Fix in accessing NULL if resource didn't get.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Varka Bhadram 2014-11-04 07:17:10 +05:30 коммит произвёл Greg Kroah-Hartman
Родитель 55dc68c012
Коммит 6827f7e311
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -86,14 +86,14 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
hcd->regs = devm_ioremap_resource(&pdev->dev, res); hcd->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(hcd->regs)) { if (IS_ERR(hcd->regs)) {
ret = PTR_ERR(hcd->regs); ret = PTR_ERR(hcd->regs);
goto err_rmr; goto err_rmr;
} }
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
uhci = hcd_to_uhci(hcd); uhci = hcd_to_uhci(hcd);
uhci->regs = hcd->regs; uhci->regs = hcd->regs;