[PATCH v2 4/6] net: dsa: Add missing master netdev dev_put() calls

2015-10-29 Thread Neil Armstrong
Upon probe failure or unbinding, add missing dev_put() calls on
master netdev.

Signed-off-by: Neil Armstrong 
---
 net/dsa/dsa.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index b2f696c..597a462 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -928,8 +928,10 @@ static int dsa_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dst);

ret = dsa_setup_dst(dst, dev, >dev, pd);
-   if (ret)
+   if (ret) {
+   dev_put(dev);
goto out;
+   }

return 0;

@@ -963,6 +965,8 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
if (ds)
dsa_switch_destroy(ds);
}
+
+   dev_put(dst->master_netdev);
 }

 static int dsa_remove(struct platform_device *pdev)
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/6] net: dsa: Add missing master netdev dev_put() calls

2015-10-29 Thread Neil Armstrong
Upon probe failure or unbinding, add missing dev_put() calls on
master netdev.

Signed-off-by: Neil Armstrong 
---
 net/dsa/dsa.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index b2f696c..597a462 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -928,8 +928,10 @@ static int dsa_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dst);

ret = dsa_setup_dst(dst, dev, >dev, pd);
-   if (ret)
+   if (ret) {
+   dev_put(dev);
goto out;
+   }

return 0;

@@ -963,6 +965,8 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
if (ds)
dsa_switch_destroy(ds);
}
+
+   dev_put(dst->master_netdev);
 }

 static int dsa_remove(struct platform_device *pdev)
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/