From: Varka Bhadram Date: Tue, 4 Nov 2014 01:47:10 +0000 (+0530) Subject: host: uhci-platform: fix NULL pointer dereference on resource X-Git-Tag: v5.15~16683^2~82 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6827f7e3113ae11689546404f557fbfdba20aa50;p=platform%2Fkernel%2Flinux-starfive.git host: uhci-platform: fix NULL pointer dereference on resource Fix in accessing NULL if resource didn't get. Signed-off-by: Varka Bhadram Acked-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index b987f1d..cf8f460 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -86,14 +86,14 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) return -ENOMEM; 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); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err_rmr; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + uhci = hcd_to_uhci(hcd); uhci->regs = hcd->regs;