Received: by 10.213.65.68 with SMTP id h4csp1823706imn; Thu, 29 Mar 2018 11:42:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+2iJfZT3kuO59m5Ph8AbTs3tOi9Rh/rX0nQ1fcoje3ulPQXZVbmRMRwunKvQvTUuU3C1AR X-Received: by 10.101.100.203 with SMTP id t11mr6330491pgv.129.1522348935738; Thu, 29 Mar 2018 11:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522348935; cv=none; d=google.com; s=arc-20160816; b=qoopMaSUjsoLl2BLmGtQHp2KcwYMXFVYkPIOFrTm8U4GUBwgvoBUCyUPEq71PZf53E BK2f1nOSlCdsjkqlJxHoeAPgL4xc4NicPymaRW+jwxntZapYK4HrhMdw2GXAWwci5x75 iE7g8rYByjRhoMVaNQr9TdmuIYA/uiAHjQheoewqukbXEfUfEoX01fvVn4nBrlFbcLwU Vny0755uca3a++PKlNpBxviPbLQnDFzkHkaWfEFC7WKqg8+1CLBqvCpobmfcmCusSiJZ YgeV+2XZk/GmMAKYOduZCPS1aAyyEsDYOfXJS+f8g2PoPncKbYIpzey47tZ6SQtN5Z55 pkYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=NbYTuZMfuAXyNgJzdxH1uNOnX3LMAOAhYYBuEgLzuXM=; b=Bhlc+42xtYnxuOb6oCHuy9mANhi2YkUf4A3FkJiwdrKA8ak7oiVRe2K3vj2wiE/BcE cu5zmTeS5JN92aA/DyFqYORuvpMXHnkJXpChu0EuQFP/nUEaeXAd2olwKxMVbK6TcAkI gOamTqy5QcEQZKL11msu2IDL4wKDVzjGvRfBhgLYl3gl/OeWQMUs3U1SWMfNXeanIYTA MANGul+UTeomJERV2zUz7qX+b2Mwtgb17CgYBnWok81aEV5IESbfeIhMMbskh2NYMSRP wX7euyB/hxEu3hXy8sHTqwnJugfby88Dpmw6YJMXhyQ6zVN9W5b4UriZPEAQkx6VH6Yr 9dvA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q61-v6si6352061plb.719.2018.03.29.11.42.01; Thu, 29 Mar 2018 11:42:15 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752502AbeC2SCG (ORCPT + 99 others); Thu, 29 Mar 2018 14:02:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58054 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752414AbeC2SCC (ORCPT ); Thu, 29 Mar 2018 14:02:02 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 00A7EC18; Thu, 29 Mar 2018 18:02:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Andrew Lunn , Grygorii Strashko , "David S. Miller" Subject: [PATCH 4.15 07/47] net: phy: relax error checking when creating sysfs link netdev->phydev Date: Thu, 29 Mar 2018 19:59:48 +0200 Message-Id: <20180329175729.678329945@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180329175729.225211114@linuxfoundation.org> References: <20180329175729.225211114@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Grygorii Strashko [ Upstream commit 4414b3ed74be0e205e04e12cd83542a727d88255 ] Some ethernet drivers (like TI CPSW) may connect and manage >1 Net PHYs per one netdevice, as result such drivers will produce warning during system boot and fail to connect second phy to netdevice when PHYLIB framework will try to create sysfs link netdev->phydev for second PHY in phy_attach_direct(), because sysfs link with the same name has been created already for the first PHY. As result, second CPSW external port will became unusable. Fix it by relaxing error checking when PHYLIB framework is creating sysfs link netdev->phydev in phy_attach_direct(), suppressing warning by using sysfs_create_link_nowarn() and adding error message instead. After this change links (phy->netdev and netdev->phy) creation failure is not fatal any more and system can continue working, which fixes TI CPSW issue. Cc: Florian Fainelli Cc: Andrew Lunn Fixes: a3995460491d ("net: phy: Relax error checking on sysfs_create_link()") Signed-off-by: Grygorii Strashko Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/phy_device.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -999,10 +999,17 @@ int phy_attach_direct(struct net_device err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj, "attached_dev"); if (!err) { - err = sysfs_create_link(&dev->dev.kobj, &phydev->mdio.dev.kobj, - "phydev"); - if (err) - goto error; + err = sysfs_create_link_nowarn(&dev->dev.kobj, + &phydev->mdio.dev.kobj, + "phydev"); + if (err) { + dev_err(&dev->dev, "could not add device link to %s err %d\n", + kobject_name(&phydev->mdio.dev.kobj), + err); + /* non-fatal - some net drivers can use one netdevice + * with more then one phy + */ + } phydev->sysfs_links = true; }