host: ehci-sead3: fix NULL pointer dereference on resource
authorVarka Bhadram <varkabhadram@gmail.com>
Tue, 4 Nov 2014 01:47:11 +0000 (07:17 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:00:51 +0000 (09:00 -0800)
Fix on accessing NULL pointer dereference on get resource failed.

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/ehci-sead3.c

index cf126767386839cacdcfce0191eea95acc8c8b32..9b6e8d0eac43e0fb3bf523df9117e02524cb5e05 100644 (file)
@@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_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 err1;
        }
+       hcd->rsrc_start = res->start;
+       hcd->rsrc_len = resource_size(res);
 
        /* Root hub has integrated TT. */
        hcd->has_tt = 1;