netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: netdev@vger.kernel.org
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Subject: [PATCH 1/3] stmmac: fix a bug while checking the HW cap reg (v2)
Date: Thu, 27 Oct 2011 07:43:07 +0200	[thread overview]
Message-ID: <1319694189-25223-1-git-send-email-peppe.cavallaro@st.com> (raw)
In-Reply-To: <1319637339-14866-1-git-send-email-peppe.cavallaro@st.com>

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

  parent reply	other threads:[~2011-10-27  5:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Giuseppe CAVALLARO [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319694189-25223-1-git-send-email-peppe.cavallaro@st.com \
    --to=peppe.cavallaro@st.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).