linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] dpaa_eth: a couple of fixes
@ 2017-01-04 11:21 Madalin Bucur
  2017-01-04 11:21 ` [PATCH 1/2] dpaa_eth: cleanup after init_phy() failure Madalin Bucur
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Madalin Bucur @ 2017-01-04 11:21 UTC (permalink / raw)
  To: netdev; +Cc: davem, linuxppc-dev, linux-kernel

Add cleanup on PHY initialization failure path, avoid using
uninitialized memory at CGR init.

Madalin Bucur (1):
  dpaa_eth: cleanup after init_phy() failure

Roy Pledge (1):
  dpaa_eth: Initialize CGR structure before init

 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] dpaa_eth: cleanup after init_phy() failure
  2017-01-04 11:21 [PATCH 0/2] dpaa_eth: a couple of fixes Madalin Bucur
@ 2017-01-04 11:21 ` Madalin Bucur
  2017-01-04 11:21 ` [PATCH 2/2] dpaa_eth: Initialize CGR structure before init Madalin Bucur
  2017-01-04 18:45 ` [PATCH 0/2] dpaa_eth: a couple of fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Madalin Bucur @ 2017-01-04 11:21 UTC (permalink / raw)
  To: netdev; +Cc: davem, linuxppc-dev, linux-kernel

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 624ba90..77517aa 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2291,7 +2291,8 @@ static int dpaa_open(struct net_device *net_dev)
 	net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev);
 	if (!net_dev->phydev) {
 		netif_err(priv, ifup, net_dev, "init_phy() failed\n");
-		return -ENODEV;
+		err = -ENODEV;
+		goto phy_init_failed;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
@@ -2314,6 +2315,7 @@ static int dpaa_open(struct net_device *net_dev)
 	for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++)
 		fman_port_disable(mac_dev->port[i]);
 
+phy_init_failed:
 	dpaa_eth_napi_disable(priv);
 
 	return err;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] dpaa_eth: Initialize CGR structure before init
  2017-01-04 11:21 [PATCH 0/2] dpaa_eth: a couple of fixes Madalin Bucur
  2017-01-04 11:21 ` [PATCH 1/2] dpaa_eth: cleanup after init_phy() failure Madalin Bucur
@ 2017-01-04 11:21 ` Madalin Bucur
  2017-01-04 18:45 ` [PATCH 0/2] dpaa_eth: a couple of fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Madalin Bucur @ 2017-01-04 11:21 UTC (permalink / raw)
  To: netdev; +Cc: davem, linuxppc-dev, linux-kernel

From: Roy Pledge <roy.pledge@nxp.com>

The QBMan CGR options needs to be zeroed before calling the init
function

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 77517aa..c9b7ad6 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -733,6 +733,7 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv)
 	priv->cgr_data.cgr.cb = dpaa_eth_cgscn;
 
 	/* Enable Congestion State Change Notifications and CS taildrop */
+	memset(&initcgr, 0, sizeof(initcgr));
 	initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES);
 	initcgr.cgr.cscn_en = QM_CGR_EN;
 
@@ -2422,6 +2423,7 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv *priv)
 	}
 
 	/* Enable CS TD, but disable Congestion State Change Notifications. */
+	memset(&initcgr, 0, sizeof(initcgr));
 	initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES);
 	initcgr.cgr.cscn_en = QM_CGR_EN;
 	cs_th = DPAA_INGRESS_CS_THRESHOLD;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] dpaa_eth: a couple of fixes
  2017-01-04 11:21 [PATCH 0/2] dpaa_eth: a couple of fixes Madalin Bucur
  2017-01-04 11:21 ` [PATCH 1/2] dpaa_eth: cleanup after init_phy() failure Madalin Bucur
  2017-01-04 11:21 ` [PATCH 2/2] dpaa_eth: Initialize CGR structure before init Madalin Bucur
@ 2017-01-04 18:45 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-01-04 18:45 UTC (permalink / raw)
  To: madalin.bucur; +Cc: netdev, linuxppc-dev, linux-kernel

From: Madalin Bucur <madalin.bucur@nxp.com>
Date: Wed, 4 Jan 2017 13:21:28 +0200

> Add cleanup on PHY initialization failure path, avoid using
> uninitialized memory at CGR init.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-04 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-04 11:21 [PATCH 0/2] dpaa_eth: a couple of fixes Madalin Bucur
2017-01-04 11:21 ` [PATCH 1/2] dpaa_eth: cleanup after init_phy() failure Madalin Bucur
2017-01-04 11:21 ` [PATCH 2/2] dpaa_eth: Initialize CGR structure before init Madalin Bucur
2017-01-04 18:45 ` [PATCH 0/2] dpaa_eth: a couple of fixes David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).