All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] stmmac: fix a bug while checking the HW cap reg
@ 2011-10-26 13:55 Giuseppe CAVALLARO
  2011-10-26 13:55 ` [PATCH 2/3] stmmac: fix NULL pointer dereference in capabilities fixup Giuseppe CAVALLARO
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Giuseppe CAVALLARO @ 2011-10-26 13:55 UTC (permalink / raw)
  To: netdev; +Cc: keguang.zhang, Giuseppe Cavallaro

The patch fixes a bug while checking the HW cap reg
on old MAC10/100 where this feature is not available.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index aeaa15b..fcdd5a2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -812,9 +812,10 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv)
  */
 static int stmmac_get_hw_features(struct stmmac_priv *priv)
 {
-	u32 hw_cap = priv->hw->dma->get_hw_feature(priv->ioaddr);
+	u32 hw_cap = 0;
+	if (priv->hw->dma->get_hw_feature) {
+		hw_cap = priv->hw->dma->get_hw_feature(priv->ioaddr);
 
-	if (likely(hw_cap)) {
 		priv->dma_cap.mbps_10_100 = (hw_cap & DMA_HW_FEAT_MIISEL);
 		priv->dma_cap.mbps_1000 = (hw_cap & DMA_HW_FEAT_GMIISEL) >> 1;
 		priv->dma_cap.half_duplex = (hw_cap & DMA_HW_FEAT_HDSEL) >> 2;
-- 
1.7.4.4

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

end of thread, other threads:[~2011-10-28  3:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-26 13:55 [PATCH 1/3] stmmac: fix a bug while checking the HW cap reg Giuseppe CAVALLARO
2011-10-26 13:55 ` [PATCH 2/3] stmmac: fix NULL pointer dereference in capabilities fixup Giuseppe CAVALLARO
2011-10-26 21:23   ` David Miller
2011-10-26 22:34     ` David Miller
2011-10-26 22:26   ` Ben Hutchings
2011-10-27  5:36     ` Giuseppe CAVALLARO
2011-10-26 13:55 ` [PATCH 3/3] stmmac: update normal descriptor structure Giuseppe CAVALLARO
2011-10-26 21:23   ` David Miller
2011-10-26 21:23 ` [PATCH 1/3] stmmac: fix a bug while checking the HW cap reg David Miller
2011-10-27  5:43 ` [PATCH 1/3] stmmac: fix a bug while checking the HW cap reg (v2) Giuseppe CAVALLARO
2011-10-27  5:43   ` [PATCH 2/3] stmmac: fix NULL pointer dereference in capabilities fixup (v2) Giuseppe CAVALLARO
2011-10-27  5:43   ` [PATCH 3/3] stmmac: update normal descriptor structure (v2) Giuseppe CAVALLARO
2011-10-28  3:17   ` [PATCH 1/3] stmmac: fix a bug while checking the HW cap reg (v2) David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.