host: uhci-platform: fix NULL pointer dereference on resource
authorVarka Bhadram <varkabhadram@gmail.com>
Tue, 4 Nov 2014 01:47:10 +0000 (07:17 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:00:51 +0000 (09:00 -0800)
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>
drivers/usb/host/uhci-platform.c

index b987f1d10058d99aa0e8239118a044e3d1523d1e..cf8f46003f622f0d80b44b6e005ebb5febeef6a0 100644 (file)
@@ -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;