From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shawn Guo Subject: [PATCH v4 2/3] net/fec: fix fec1 check in fec_enet_mii_init() Date: Thu, 22 Sep 2011 13:10:17 +0800 Message-ID: <1316668218-10194-3-git-send-email-shawn.guo@linaro.org> References: <1316668218-10194-1-git-send-email-shawn.guo@linaro.org> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , Shawn Guo To: "David S. Miller" Return-path: Received: from va3ehsobe004.messaging.microsoft.com ([216.32.180.14]:57784 "EHLO VA3EHSOBE004.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750746Ab1IVFA6 (ORCPT ); Thu, 22 Sep 2011 01:00:58 -0400 In-Reply-To: <1316668218-10194-1-git-send-email-shawn.guo@linaro.org> Sender: netdev-owner@vger.kernel.org List-ID: In function fec_enet_mii_init(), it uses non-zero pdev->id as part of the condition to check the second fec instance (fec1). This works before the driver supports device tree probe. But in case of device tree probe, pdev->id is -1 which is also non-zero, so the logic becomes broken when device tree probe gets supported. The patch change the logic to check "pdev->id > 0" as the part of the condition for identifying fec1. Signed-off-by: Shawn Guo Acked-by: Wolfram Sang --- drivers/net/ethernet/freescale/fec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 9c1d059..2bbe6a5 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c @@ -996,7 +996,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) * mdio interface in board design, and need to be configured by * fec0 mii_bus. */ - if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && pdev->id) { + if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && pdev->id > 0) { /* fec1 uses fec0 mii_bus */ fep->mii_bus = fec0_mii_bus; return 0; -- 1.7.4.1