From: Varka Bhadram <varkabhad...@gmail.com>

Sanity check on resource happening with devm_ioremap_resource().

Also fix in accessing NULL if resource didn't get.

Signed-off-by: Varka Bhadram <var...@cdac.in>
Acked-by: Alan Stern <st...@rowland.harvard.edu>
---
 drivers/usb/host/uhci-platform.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index b987f1d..081330c 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -86,14 +86,15 @@ 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;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to