Hello.

On 10/30/2014 06:52 PM, varkabhad...@gmail.com wrote:

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

Sanity check on resource happening with devm_ioremap_resource().

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

diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
index cf12676..9b6e8d0 100644
--- a/drivers/usb/host/ehci-sead3.c
+++ b/drivers/usb/host/ehci-sead3.c
@@ -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);

   Oops, this would blow up if 'res' is NULL.

-
        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);

   So this is actually a fix, not a cleanup.

WBR, Sergei

--
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