From patchwork Thu Mar 18 09:09:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wong, Vee Khee" X-Patchwork-Id: 404610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56A82C433E6 for ; Thu, 18 Mar 2021 09:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A86C64F18 for ; Thu, 18 Mar 2021 09:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbhCRJFz (ORCPT ); Thu, 18 Mar 2021 05:05:55 -0400 Received: from mga03.intel.com ([134.134.136.65]:10982 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhCRJFa (ORCPT ); Thu, 18 Mar 2021 05:05:30 -0400 IronPort-SDR: I4QSBcDttPm3Dqga/8UFFnI+e/0J5I80LDy88Lxz19hIP7Rk9Q9pVq1xq/42W18uMJhA2eYmsu gObtBFt26vWg== X-IronPort-AV: E=McAfee;i="6000,8403,9926"; a="189680237" X-IronPort-AV: E=Sophos;i="5.81,258,1610438400"; d="scan'208";a="189680237" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 02:05:30 -0700 IronPort-SDR: hk1yorJL8O8FykbM/JjTKrcSQC9oqv23EYpanBd3nw0Fr62+mSv+J4CUl6v+bPqFCf1dHfpnmp j97KseJ5l6Ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,258,1610438400"; d="scan'208";a="372645266" Received: from glass.png.intel.com ([10.158.65.59]) by orsmga003.jf.intel.com with ESMTP; 18 Mar 2021 02:05:27 -0700 From: Wong Vee Khee To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski Cc: Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Voon Weifeng , Ong Boon Leong Subject: [PATCH net V2 1/1] net: phy: fix invalid phy id when probe using C22 Date: Thu, 18 Mar 2021 17:09:37 +0800 Message-Id: <20210318090937.26465-1-vee.khee.wong@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When using Clause-22 to probe for PHY devices such as the Marvell 88E2110, PHY ID with value 0 is read from the MII PHYID registers which caused the PHY framework failed to attach the Marvell PHY driver. Fixed this by adding a check of PHY ID equals to all zeroes. Fixes: ee951005e95e ("net: phy: clean up get_phy_c22_id() invalid ID handling") Cc: stable@vger.kernel.org Reviewed-by: Voon Weifeng Signed-off-by: Wong Vee Khee Reported-by: kernel test robot --- v2 changelog: - added fixes tag - marked for net instead of net-next --- drivers/net/phy/phy_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index cc38e326405a..c12c30254c11 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -809,8 +809,8 @@ static int get_phy_c22_id(struct mii_bus *bus, int addr, u32 *phy_id) *phy_id |= phy_reg; - /* If the phy_id is mostly Fs, there is no device there */ - if ((*phy_id & 0x1fffffff) == 0x1fffffff) + /* If the phy_id is mostly Fs or all zeroes, there is no device there */ + if (((*phy_id & 0x1fffffff) == 0x1fffffff) || (*phy_id == 0)) return -ENODEV; return 0;