Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2096159pxb; Mon, 12 Apr 2021 14:22:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZR71ql7hGmBP7pMzmjt8sSMe0Q5KDhCF7RLVGBWdiB2AJMsJ/qbmPz8XMXGJGM8RrqTMX X-Received: by 2002:a05:6402:2807:: with SMTP id h7mr30326466ede.217.1618262549383; Mon, 12 Apr 2021 14:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618262549; cv=none; d=google.com; s=arc-20160816; b=Z6OCjANyKaCnsFefgBGP+b8PP8i+ENUdDxL2Uqi2olHjvgUWl1/Fiueod2/eMdz9PK 7ijI7waVVNvFZEsrMvBIPlSzzKMGpHAB5f7ZMEIwchSBr1uImSin0C96HNIU4Swe3G9s 5kqnciOTZ4lyyUp9qEJx9D5bzoouKc8v88NUnIf8h4aalVUNuDf+4krrBW4/tSYEnmkT OlhXfhQKGbpiXO0LhJcwTpXN6lflmLkzszZ5cXO99HmT3DwxxqPOjV+cr/hKEEeeczVE J0TOWccpks0xj5jTaK8d63evW+9EnzEKZW8+5P3HUKwqvlKdcZ3q3Dyr2PpXq0YIyaTB ti8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HttPzxikgyDMhaxDmexEhoE0caqOIjUqDUa/pihJsEQ=; b=l2Ep74tAnJcsG7aOM/kK8UIGdEUy5h+IqChNEcMOUZjPOBrd3akEFrlnJXe8jAFCJg qFybQusA6WxelOvHBlviH7jWZXNh751dMDrkIceU0pMuuH3//QVfHqQJMHDSROe5IjTo V3ZFu+BKOyfj6wAoLyKigzeDkY0YpGgoZKDJdh7+v7HkwqiJOt32ZCzW9zh1wFACjfV2 8kp5CQYrj6XWDczOrNje9Se1EZ8fJC/h6oXvXEXQwJZYRec5tZy4K6/VpoXcOIqhBzUA up03YyGrLF+EnSOovOiUydX7w6LNfKvhrjUS94+uN2FQeJGp/+VhZIPtdoQnZW5lmBOv IYZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1K9UYZem; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si8155028edr.525.2021.04.12.14.22.03; Mon, 12 Apr 2021 14:22:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1K9UYZem; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240646AbhDLJKt (ORCPT + 99 others); Mon, 12 Apr 2021 05:10:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:44692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239082AbhDLIzm (ORCPT ); Mon, 12 Apr 2021 04:55:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3675061207; Mon, 12 Apr 2021 08:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217721; bh=2vlpjWMa4k7gcKDJtUV+aw0btDtN/qb3dbfGmDMAHwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1K9UYZemAqPmE9qaA/1cyytSA9g+u3+381+nyq77Zl9TDiPEUIdof9erBI+foDLrJ zXT3NFb8CL7JOl3gnf9QwuB6jwE96oZkpOIUbwahFDV2xKuwdYYGwGuKNymRUU6tFc NpfIjogUiVUjln7COONxGTBYabjGLgfSvkZxhoWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Kochetkov , Vladimir Oltean , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 121/188] net: dsa: Fix type was not set for devlink port Date: Mon, 12 Apr 2021 10:40:35 +0200 Message-Id: <20210412084017.672721816@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Kochetkov [ Upstream commit fb6ec87f7229b92baa81b35cbc76f2626d5bfadb ] If PHY is not available on DSA port (described at devicetree but absent or failed to detect) then kernel prints warning after 3700 secs: [ 3707.948771] ------------[ cut here ]------------ [ 3707.948784] Type was not set for devlink port. [ 3707.948894] WARNING: CPU: 1 PID: 17 at net/core/devlink.c:8097 0xc083f9d8 We should unregister the devlink port as a user port and re-register it as an unused port before executing "continue" in case of dsa_port_setup error. Fixes: 86f8b1c01a0a ("net: dsa: Do not make user port errors fatal") Signed-off-by: Maxim Kochetkov Reviewed-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/dsa/dsa2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index a04fd637b4cd..3ada338d7e08 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -533,8 +533,14 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) list_for_each_entry(dp, &dst->ports, list) { err = dsa_port_setup(dp); - if (err) + if (err) { + dsa_port_devlink_teardown(dp); + dp->type = DSA_PORT_TYPE_UNUSED; + err = dsa_port_devlink_setup(dp); + if (err) + goto teardown; continue; + } } return 0; -- 2.30.2