summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarka Bhadram <varkabhadram@gmail.com>2014-11-04 07:17:10 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-07 09:00:51 -0800
commit6827f7e3113ae11689546404f557fbfdba20aa50 (patch)
treed31b1358ffaa78b692ba7ee9f0d63209f5b4f65f
parent55dc68c012bf056880c03d9f6eb34c00880f9e88 (diff)
downloadlwn-6827f7e3113ae11689546404f557fbfdba20aa50.tar.gz
lwn-6827f7e3113ae11689546404f557fbfdba20aa50.zip
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>
-rw-r--r--drivers/usb/host/uhci-platform.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index b987f1d10058..cf8f46003f62 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;