From nobody Thu Nov 28 04:44:48 2024 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BE6777117; Fri, 4 Oct 2024 04:12:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728015148; cv=none; b=B5E+3JmX9QM+KrbzWBfoovn4Y8KThMCIBsRXmQdcwHkqoWqRdU4wdpcM9cJGQxgqKzdYCodi8WuR0V3m3jfgPVXXxyBZvVUYDZpel02AY/FsjMMxRqjQJC5YBvqOmc852yJRaKy9dJzaVN62+feTr9mevqhm+JvjMYsrpmfVSb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728015148; c=relaxed/simple; bh=B31Mkons8hVN2qdjdVwaCtXp3RZ+4hvJnET2H9fYdTU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HEKj3JtIBc/QuxRY0F2YGWpj8XfguW2aljrZncTVebe1EcQfX0oy7+VbgtYzvuKYeoQycy81ICLSdgh/Jw3xfqAAObIav/2oznOQtFA9IxWE8K2hAFMY0NtHR4h++fOxpN6ptuyJqwKq4km8HL+7vqCaZ4YyF6kUm6bn46sJ5MI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fluxnic.net; spf=pass smtp.mailfrom=fluxnic.net; dkim=pass (1024-bit key) header.d=fluxnic.net header.i=@fluxnic.net header.b=FS2e6Ay3; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=ZsHChlBT; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Jj1k5W3V; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fluxnic.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fluxnic.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fluxnic.net header.i=@fluxnic.net header.b="FS2e6Ay3"; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="ZsHChlBT"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Jj1k5W3V" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 6BA961140247; Fri, 4 Oct 2024 00:12:25 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-02.internal (MEProxy); Fri, 04 Oct 2024 00:12:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fluxnic.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=2016-12.pbsmtp; t=1728015145; x=1728101545; bh=2r0rT23pyzNvoOWF6CsSNG48Bqqp/sBTZE4ykZf73TU=; b= FS2e6Ay3HakOihowwEJmVA8rqoWmujXjhK26yKtc3sCRU2fW/r2tEWKrui3iOI28 1e1LNeRMbL4dqA1sWD5Yz2xeCkCxeuM1vNvfKqnqpI6fAsPA6SKiKoC9TFpqP6Ne 3aJMqrZ/iSpA8rvgvDOAiZOCLoGCeXC1hqDTvfbFCks= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1728015145; x= 1728101545; bh=2r0rT23pyzNvoOWF6CsSNG48Bqqp/sBTZE4ykZf73TU=; b=Z sHChlBT5LqqF1a8iYCM7v/4L9pp5irAqV8mqdtblZ+5LWdytyUa/CuQoklHUeLdB t3OgPL8OxAycs/eV2ZDflHDpIsU27ooLXsW7CAMjOBh9HC0xjIuQfy2USRMHP0Hy 4wrY0HcPg7jhnwvVtdJWhq3kXNsia3AzpxV26h9GCsojiJhaCjGBfWfj6AL9opb/ 0B5m7VP5oRexm3zmi+njtY8M8QPlOMGDTTIbo6Nee6cOEXkJG6p/dzZKiGjKWUa1 hIBSOpZ2eJSiBVTIUmBInHDmrmMtQT5Kz7jRRn2RCKcmvgcsmjnMGJhareMtxmAS iYRWR3bBeLNYMXAQ2lOjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728015145; x= 1728101545; bh=2r0rT23pyzNvoOWF6CsSNG48Bqqp/sBTZE4ykZf73TU=; b=J j1k5W3VZYkNyIe91rfVJtdfyOuixkix1cKG3dY0fKj0hPw3DDb1uxfd6YKexjZmV fiq4AtP1pUBO238Szv/OzEEbhN11F4y2iCDd2MUvpNyreT2QE3fXgI5j/ETm01xc syB+s6QOzEsipXog+DEVEA1nAvuiwQVGxpZV0aYsCXFxN8S1072PwyG53PrZscLr 3g1XcuDDmlbC2JDOjl8dkchwBeiLpZpLCIuDIEM9Jaiql+ePn61UuVFPxQEDgPiy RpSdjteayEdEOI+DpuipdDX0PZ2kuN/mZVGJilWKMcohVnSag4r7QRKDorw9Yfcr xoPPoQpu60od3yZWUngSQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvvddgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredttden ucfhrhhomheppfhitgholhgrshcurfhithhrvgcuoehnihgtohesfhhluhignhhitgdrnh gvtheqnecuggftrfgrthhtvghrnheptdejueeiieehieeuffduvdffleehkeelgeekudek feffhfduffdugedvteeihfetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepnhhitghosehflhhugihnihgtrdhnvghtpdhnsggprhgtphhtthho pedutddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepnhhpihhtrhgvsegsrgihlh hisghrvgdrtghomhdprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhnvght pdhrtghpthhtohepvgguuhhmrgiivghtsehgohhoghhlvgdrtghomhdprhgtphhtthhope hkuhgsrgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhoghgvrhhqsehkvghrnhgv lhdrohhrghdprhgtphhtthhopehprggsvghnihesrhgvughhrghtrdgtohhmpdhrtghpth htohepghhrhihgohhrihhirdhsthhrrghshhhkohesthhirdgtohhmpdhrtghpthhtohep vhhighhnvghshhhrsehtihdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlh esvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i58514971:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Oct 2024 00:12:24 -0400 (EDT) Received: from xanadu.lan (OpenWrt.lan [192.168.1.1]) by yoda.fluxnic.net (Postfix) with ESMTPSA id 2AF26E3D83C; Fri, 4 Oct 2024 00:12:24 -0400 (EDT) From: Nicolas Pitre To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Grygorii Strashko , Vignesh Raghavendra , Roger Quadros Cc: Nicolas Pitre , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 1/2] net: ethernet: ti: am65-cpsw: prevent WARN_ON upon module removal Date: Fri, 4 Oct 2024 00:10:33 -0400 Message-ID: <20241004041218.2809774-2-nico@fluxnic.net> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241004041218.2809774-1-nico@fluxnic.net> References: <20241004041218.2809774-1-nico@fluxnic.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Nicolas Pitre In am65_cpsw_nuss_remove(), move the call to am65_cpsw_unregister_devlink() after am65_cpsw_nuss_cleanup_ndev() to avoid triggering the WARN_ON(devlink_port->type !=3D DEVLINK_PORT_TYPE_NOTSET) in devl_port_unregister(). Makes it coherent with usage in m65_cpsw_nuss_register_ndevs()'s cleanup path. Fixes: 58356eb31d60 ("net: ti: am65-cpsw-nuss: Add devlink support") Signed-off-by: Nicolas Pitre Reviewed-by: Roger Quadros --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/etherne= t/ti/am65-cpsw-nuss.c index cbe99017cb..f6bc8a4dc6 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -3652,13 +3652,13 @@ static void am65_cpsw_nuss_remove(struct platform_d= evice *pdev) return; } =20 - am65_cpsw_unregister_devlink(common); am65_cpsw_unregister_notifiers(common); =20 /* must unregister ndevs here because DD release_driver routine calls * dma_deconfigure(dev) before devres_release_all(dev) */ am65_cpsw_nuss_cleanup_ndev(common); + am65_cpsw_unregister_devlink(common); am65_cpsw_nuss_phylink_cleanup(common); am65_cpts_release(common->cpts); am65_cpsw_disable_serdes_phy(common); --=20 2.46.1 From nobody Thu Nov 28 04:44:48 2024 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BE3577107; Fri, 4 Oct 2024 04:12:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728015149; cv=none; b=rszl1I7S2RpElbh/NmqIv1WgDPh6sVxXA1XnQ3I6nlnPTHfsCnJ1MSiByHa0kh3JiejRt+jjUcaSI4ZoKh4/GMr6Lvmq9v5GK/mBZzRNgzLxZdTDe0l12r855iXa/5BxAv6g2yS4UESG+Q0lFbRYgWpfSSCNO4l95dzNweIUspw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728015149; c=relaxed/simple; bh=ShIQQg1VHwsJok8ffAk6GFo1fdSFrP8iYTRSiNnc4TM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qHdMuCMZ0wG6VHJsF46hEcdjlJrX9y4jY+0ieaEfIGfmt5G3rP4EyJ3WRIEj6zLhfeL+GEaulJQnR0Y/cYQe5wlTQNqKDnD7T3xTy6BNWiRUIMANFIUyp7MZJPxMVBKD8yYxp5MVrv2jDl07TxwefzbIGSL/1CpMbjx9ryvj7lc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fluxnic.net; spf=pass smtp.mailfrom=fluxnic.net; dkim=pass (1024-bit key) header.d=fluxnic.net header.i=@fluxnic.net header.b=M5mCmZvx; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=mK2dEOAy; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=qXQIYR+Y; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fluxnic.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fluxnic.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fluxnic.net header.i=@fluxnic.net header.b="M5mCmZvx"; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="mK2dEOAy"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qXQIYR+Y" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 7299E1140249; Fri, 4 Oct 2024 00:12:25 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-04.internal (MEProxy); Fri, 04 Oct 2024 00:12:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fluxnic.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=2016-12.pbsmtp; t=1728015145; x=1728101545; bh=eHTbyG0oDxNayxdZzQC2GQk/sSeoZeAzVlGODWuCYCs=; b= M5mCmZvxmOaxor32TdsyASTZrEzbNkOeGLQiZvHTEu+7b3AQy9o+Cg7Cc9rFI/r1 HLzQ8Oj5vPCNjx6UrNxfA89KARqyD3UXiNLwcMkZJv/8TV1b5strpTZIdsY6lEgL qyRzjP5I2Ik6GlwtrdTWKyeCokOnDfdLvGeMX1hQfB4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1728015145; x= 1728101545; bh=eHTbyG0oDxNayxdZzQC2GQk/sSeoZeAzVlGODWuCYCs=; b=m K2dEOAyTrD3PlKBJbn8G1QTW6UAFv3SlARcK4u9ajcl3KrN8KTmqvMsIL5nIpJ07 2y816aYJ0ZDf+w77XW3lym9maIGAjKMImkBjSZhj+PlCQ5UMbpsAOvbNVJbhXgKp UwpobebX0E8P+3Ohz5eTIX5b4Usiyiw3ie0yulY2bhKAsRkVzO0z5aQuP+jvhe2V daT5AEdui+4P1mqk0Uibq/+VuoXfzKRW9T2FwEoCLnKz1XKe56ntG6KDv7k3qzrU Xgr+eQZk1TYaEMBXF2ZkjU+j+6OALSJc/5pkbj3WL/Gn2Sw0nIikb8twWX/YIAfq Gz7sQA/WI/0EHzGfIW0MQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728015145; x= 1728101545; bh=eHTbyG0oDxNayxdZzQC2GQk/sSeoZeAzVlGODWuCYCs=; b=q XQIYR+YbfambeDm1BBQ4PbibKMo2CF6VKLqxYXvUj0Pj03r4VJfNNJLfokSwxwzn i/+Rsd0EXyZX6Z8vvCA8eJmf0My4/5VxbaCZFCSr4nD0/FF7wCxR1mafvNgXWIRA JcXSgMt41qP83FoKloeD+pqRNjMAhCTKONnW822g0L8yQTisQCS0EzWZU+G1sVCN zHNChAZEnECxGKnmpLU6fKOiWF3stjOHn5sqWLEvvvxwVVTJWncrSaJNYseiSub3 5sQfSe8L7rBJoYcfFcC2OuhLDaanLE6hHqomygfGv/1GVQHkrz3doIURk2PfZVrN NeKILUQsNgI9qgp2JQt8g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvvddgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredttden ucfhrhhomheppfhitgholhgrshcurfhithhrvgcuoehnihgtohesfhhluhignhhitgdrnh gvtheqnecuggftrfgrthhtvghrnheptdejueeiieehieeuffduvdffleehkeelgeekudek feffhfduffdugedvteeihfetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepnhhitghosehflhhugihnihgtrdhnvghtpdhnsggprhgtphhtthho pedutddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepnhhpihhtrhgvsegsrgihlh hisghrvgdrtghomhdprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhnvght pdhrtghpthhtohepvgguuhhmrgiivghtsehgohhoghhlvgdrtghomhdprhgtphhtthhope hkuhgsrgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhoghgvrhhqsehkvghrnhgv lhdrohhrghdprhgtphhtthhopehprggsvghnihesrhgvughhrghtrdgtohhmpdhrtghpth htohepghhrhihgohhrihhirdhsthhrrghshhhkohesthhirdgtohhmpdhrtghpthhtohep vhhighhnvghshhhrsehtihdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlh esvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i58514971:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Oct 2024 00:12:24 -0400 (EDT) Received: from xanadu.lan (OpenWrt.lan [192.168.1.1]) by yoda.fluxnic.net (Postfix) with ESMTPSA id 4AA92E3D83E; Fri, 4 Oct 2024 00:12:24 -0400 (EDT) From: Nicolas Pitre To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Grygorii Strashko , Vignesh Raghavendra , Roger Quadros Cc: Nicolas Pitre , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 2/2] net: ethernet: ti: am65-cpsw: avoid devm_alloc_etherdev, fix module removal Date: Fri, 4 Oct 2024 00:10:34 -0400 Message-ID: <20241004041218.2809774-3-nico@fluxnic.net> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241004041218.2809774-1-nico@fluxnic.net> References: <20241004041218.2809774-1-nico@fluxnic.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Nicolas Pitre Usage of devm_alloc_etherdev_mqs() conflicts with am65_cpsw_nuss_cleanup_ndev() as the same struct net_device instances get unregistered twice. Switch to alloc_etherdev_mqs() and make sure am65_cpsw_nuss_cleanup_ndev() unregisters and frees those net_device instances properly. With this, it is finally possible to rmmod the driver without oopsing the kernel. Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth = subsystem driver") Signed-off-by: Nicolas Pitre Reviewed-by: Roger Quadros --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/etherne= t/ti/am65-cpsw-nuss.c index f6bc8a4dc6..e95457c988 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2744,10 +2744,9 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_commo= n *common, u32 port_idx) return 0; =20 /* alloc netdev */ - port->ndev =3D devm_alloc_etherdev_mqs(common->dev, - sizeof(struct am65_cpsw_ndev_priv), - AM65_CPSW_MAX_QUEUES, - AM65_CPSW_MAX_QUEUES); + port->ndev =3D alloc_etherdev_mqs(sizeof(struct am65_cpsw_ndev_priv), + AM65_CPSW_MAX_QUEUES, + AM65_CPSW_MAX_QUEUES); if (!port->ndev) { dev_err(dev, "error allocating slave net_device %u\n", port->port_id); @@ -2868,8 +2867,12 @@ static void am65_cpsw_nuss_cleanup_ndev(struct am65_= cpsw_common *common) =20 for (i =3D 0; i < common->port_num; i++) { port =3D &common->ports[i]; - if (port->ndev && port->ndev->reg_state =3D=3D NETREG_REGISTERED) + if (!port->ndev) + continue; + if (port->ndev->reg_state =3D=3D NETREG_REGISTERED) unregister_netdev(port->ndev); + free_netdev(port->ndev); + port->ndev =3D NULL; } } =20 @@ -3613,16 +3616,17 @@ static int am65_cpsw_nuss_probe(struct platform_dev= ice *pdev) =20 ret =3D am65_cpsw_nuss_init_ndevs(common); if (ret) - goto err_free_phylink; + goto err_ndevs_clear; =20 ret =3D am65_cpsw_nuss_register_ndevs(common); if (ret) - goto err_free_phylink; + goto err_ndevs_clear; =20 pm_runtime_put(dev); return 0; =20 -err_free_phylink: +err_ndevs_clear: + am65_cpsw_nuss_cleanup_ndev(common); am65_cpsw_nuss_phylink_cleanup(common); am65_cpts_release(common->cpts); err_of_clear: --=20 2.46.1