Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp205607imj; Thu, 14 Feb 2019 18:39:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IaQbxKZywp8gb9GQvsrNQBvPDX3keT1KLD34BnWbDWDiKB7oW4OX6rGqG4pFWj2PnAsaDrN X-Received: by 2002:a17:902:243:: with SMTP id 61mr7386548plc.249.1550198394045; Thu, 14 Feb 2019 18:39:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198394; cv=none; d=google.com; s=arc-20160816; b=AQUBWqrIKPeSl0mYz68ck/s4SsnWzAoWy9lzMX9LCSx3lJbBWoMlyX6FLycvR/bjj9 7BErSe3QPGzdbYSbbgkNcRMFoBd37Px+gsNARKBmGwpofYyfP2uo7WrIFscqShvu/5iq CwZOMnhQtQqyXY0u4rTuu4EsgPOv/sVYTgLpMnUxH6BPETFprKEUhXdRdHtcnnI1cyCf xcKszV1qBedu7Ot02S4XaDtdbkpxv/qDjNq10mr79SWn7xh4uELADiyQwQAMUnYz+Mgk +t4exiuVGw2fvz68CcUT6rAzvKi0RLa61B09GULQkGWvBN6H7jVOrGNsQGbG1jQvUwEQ SV2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gCVR1ZcKHIzlgIXM7feNzs9GEOHGCuzFmezM8kw2GMs=; b=ANXoITEmbZqVYI0j9ePOMAgTivnwnINeGfi+1rS9XJhbeazHXJNmR32lCOH8v4sPh0 f6/gxZGcVST0vGVLN2VFxooiKx7F3rIXIjRfIzJ/Yem+TGqjFPKXcP87S0LAfPloE8qI 7hRBLbpLMAOPdMd/OavHoj8+HYpzDOLsyYXQPGZ54zif5kJbkc37Ceerrz63TDaJMQhG YA0K9rseevpQ298hZI4N0pNDRZ7FIlEqLJrtDXiwUjB9d65i+OZzdlahG5dbzheeWV70 Vws+IfpWvc3EUT7bXpZmIFYzjDmu6tgSH6j7FyxjeJ1EXkkxbeVbZJ+5Gq0uqHsKWl6k kxXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FQTh+7Y3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s80si3923243pgs.165.2019.02.14.18.39.38; Thu, 14 Feb 2019 18:39:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FQTh+7Y3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729014AbfBOCgZ (ORCPT + 99 others); Thu, 14 Feb 2019 21:36:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:51030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731924AbfBOCK4 (ORCPT ); Thu, 14 Feb 2019 21:10:56 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BAEF21B68; Fri, 15 Feb 2019 02:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196655; bh=4Evbn6hvxlrLo1b2tZoyJSS9dli7UapP7ISU4LP0AGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FQTh+7Y3jFhZDq82NXvd8V/0/sWVFiWIcUOeOy8thewK8dM9dRXErtlLvxQ9t9RUn AIZN9vWIbcG1sEzC6azcWdf5370jMNQey0QF2g0cSif4Lc6D8dnUny8RyjaTcKBnUz Fbead1SGmRs8j5NNFWrrtH/ziuzgbXEPtIjU/aC0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhang Run , "David S . Miller" , Sasha Levin , linux-usb@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 67/77] net: usb: asix: ax88772_bind return error when hw_reset fail Date: Thu, 14 Feb 2019 21:08:45 -0500 Message-Id: <20190215020855.176727-67-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Run [ Upstream commit 6eea3527e68acc22483f4763c8682f223eb90029 ] The ax88772_bind() should return error code immediately when the PHY was not reset properly through ax88772a_hw_reset(). Otherwise, The asix_get_phyid() will block when get the PHY Identifier from the PHYSID1 MII registers through asix_mdio_read() due to the PHY isn't ready. Furthermore, it will produce a lot of error message cause system crash.As follows: asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to send software reset: ffffffb9 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to enable software MII access asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0000: -71 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to enable software MII access asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0000: -71 ... Signed-off-by: Zhang Run Reviewed-by: Yang Wei Tested-by: Marcel Ziswiler Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/asix_devices.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index b654f05b2ccd..3d93993e74da 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c @@ -739,8 +739,13 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0); chipcode &= AX_CHIPCODE_MASK; - (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) : - ax88772a_hw_reset(dev, 0); + ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) : + ax88772a_hw_reset(dev, 0); + + if (ret < 0) { + netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret); + return ret; + } /* Read PHYID register *AFTER* the PHY was reset properly */ phyid = asix_get_phyid(dev); -- 2.19.1