]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
drivers: net: cpsw: check return code from pm runtime calls
authorGrygorii Strashko <grygorii.strashko@ti.com>
Fri, 24 Jun 2016 18:23:42 +0000 (21:23 +0300)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 20 Oct 2016 13:06:38 +0000 (08:06 -0500)
BugLink: http://bugs.launchpad.net/bugs/1625177
Add missed check of return code from PM runtime get() calls.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 108a653730e4c654bd0815276276e59ea0d64578)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
drivers/net/ethernet/ti/cpsw.c

index 41e9576cedb33d584f0a047b50a8ddd1e4296972..89c328759ade122ffb0f65459f30f39cc0c47290 100644 (file)
@@ -1252,7 +1252,11 @@ static int cpsw_ndo_open(struct net_device *ndev)
        int i, ret;
        u32 reg;
 
-       pm_runtime_get_sync(&priv->pdev->dev);
+       ret = pm_runtime_get_sync(&priv->pdev->dev);
+       if (ret < 0) {
+               pm_runtime_put_noidle(&priv->pdev->dev);
+               return ret;
+       }
 
        if (!cpsw_common_res_usage_state(priv))
                cpsw_intr_disable(priv);
@@ -2326,7 +2330,11 @@ static int cpsw_probe(struct platform_device *pdev)
        /* Need to enable clocks with runtime PM api to access module
         * registers
         */
-       pm_runtime_get_sync(&pdev->dev);
+       ret = pm_runtime_get_sync(&pdev->dev);
+       if (ret < 0) {
+               pm_runtime_put_noidle(&pdev->dev);
+               goto clean_runtime_disable_ret;
+       }
        priv->version = readl(&priv->regs->id_ver);
        pm_runtime_put_sync(&pdev->dev);