Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2144574pxb; Mon, 12 Apr 2021 15:58:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeqgbFiedRdcfoP+aORNfoxMKxqWHdJljmNlM4O3U4/EGtKRNc0pVaeGp8cxjBcZUJoJu4 X-Received: by 2002:a63:ff52:: with SMTP id s18mr29301179pgk.163.1618268337381; Mon, 12 Apr 2021 15:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618268337; cv=none; d=google.com; s=arc-20160816; b=qfS/CXpQluWAwSR+Xz18SPaUOFqWf1Csfv5b46vYRYPJYJBZLUz2Yk2Vd1C+K1fKJR +tYf17vwulSVW3PuRioel+2/YiEwalafjPd3kKMnlqeHTr+pIRSEhZ76vqEb1UMn1gBe ddnoVdsPaIqpDa55fFHrtrruOT1Q/WTcM3lqKjeqiCkvdQEZCZoKmU2R2AoVJZy8Grol y7c5WvqH9iT8lIx2gmlvNVyWxNZ5JUSb6xyagZYzqaA3W6MHJmIPhZZtLJj2HbNTTOda 1f/SMajBeDhybuaYlMuL7Nb2U3Ihc3LxwK+D6554gPoGYa7RFL6ej2ugR+NWNg+xnZh8 bjwQ== 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=xqnMsFbF+WHWBBIzF6qGcfC+YmAS1N2HlHxnR3Et3JXjkeNsupIym0F053DfMPwE65 OEA9MilY080G3+hQDq0DcOIz2cXfyKPk7SOz++cYUKsq8BsjWmL86HJF4tnUkZ3KoV1Q PIFSKMVgeECFnXwShVSdIlZFj5HFgt7lYStjC3QVWJ2eYUgKT/XNZx5jWlBV89Mp6FI2 saAhfElrFcRggL1LiNBpXEZ/6NXdC1b6VobLAOlF54eVCuYQhMOolJu64zKsVCZFxIcf VlVYI9kxg3/a9xaQy16dyNZRjJppkVZlcJ4RbynnJklBrylzP51T+VtTS0kW/9PV6N2r CQvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y+FljoUU; 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 j13si14206542pgq.300.2021.04.12.15.58.44; Mon, 12 Apr 2021 15:58:57 -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=y+FljoUU; 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 S243594AbhDLJm2 (ORCPT + 99 others); Mon, 12 Apr 2021 05:42:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:33550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240624AbhDLJKs (ORCPT ); Mon, 12 Apr 2021 05:10:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 986FF6135A; Mon, 12 Apr 2021 09:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218358; bh=2vlpjWMa4k7gcKDJtUV+aw0btDtN/qb3dbfGmDMAHwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y+FljoUUJPnjOHBzwhdYZpGi4BtpVJtXfAT3fDsw5dHevp9+NkHrbIxcyAM1BbmTZ 6Uc1qzirHCVSbZnY0y1TNIUkTgEqHtT3JzVDIPozKZull/zaodSFOpgXol2RsBUBIC el3yAeLtPj2oxyh7Op1w2ihULHkQ6s+ZO0GL1UCI= 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.11 132/210] net: dsa: Fix type was not set for devlink port Date: Mon, 12 Apr 2021 10:40:37 +0200 Message-Id: <20210412084020.412190253@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@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