From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E0355148855; Thu, 13 Jun 2024 12:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718280237; cv=none; b=cG3r5xYSSlS3JQbPKKWusN9lpqJb2pSck3NW7pxpCl8qp+75bNXEEupoS8gmlndNsaACLhzFCwqCkT9r0cXhhuSY3XOlvpU2yNxUflzHdhNehxlW7Kvn/cZDECriByobeDhV3/jdxfigpvZMnbj7oAZ9RWFSWLGRi1BzF3lxODw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718280237; c=relaxed/simple; bh=HPHYxz3SuKAi5gZq2EH1ntQxjm+xIRl7WPPS3YG3h9c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UsBHqoD7RYlq9Aup8v/ZpzHEsE88YUrbpPSvWGnLssX9k0vi3xwgqwgnBxIjVjj9lr+L9/aB7y7CU/vp6pfG3v+uL6y4wMytzIhaUHoTTFYsD4Pm2l/qRlobyQLgKLRIoVeWB9ivNGgCIy1eBZOER1lWdu8Z4s0CX/hJmnb6OvU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=auNWM6if; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="auNWM6if" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68DF9C2BBFC; Thu, 13 Jun 2024 12:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718280236; bh=HPHYxz3SuKAi5gZq2EH1ntQxjm+xIRl7WPPS3YG3h9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=auNWM6ifGQ9Hb+e7y2oVNUlxdRfVHQ0KKj3FwUp6IsGg3jSF9JUzdF7DxO9QYdVLD gLYfODgj+rR97vEUFklQtQAG+Yr5+hfkfUotB08fIxsQPF3XzFgshIrNHHycF8zt2l SvjGPIRo18L8OK9QNj+NHzu7GviSemVyJ8Iz6icM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiaolei Wang , Wei Fang , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 157/202] net:fec: Add fec_enet_deinit() Date: Thu, 13 Jun 2024 13:34:15 +0200 Message-ID: <20240613113233.807289280@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613113227.759341286@linuxfoundation.org> References: <20240613113227.759341286@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xiaolei Wang [ Upstream commit bf0497f53c8535f99b72041529d3f7708a6e2c0d ] When fec_probe() fails or fec_drv_remove() needs to release the fec queue and remove a NAPI context, therefore add a function corresponding to fec_enet_init() and call fec_enet_deinit() which does the opposite to release memory and remove a NAPI context. Fixes: 59d0f7465644 ("net: fec: init multi queue date structure") Signed-off-by: Xiaolei Wang Reviewed-by: Wei Fang Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20240524050528.4115581-1-xiaolei.wang@windriver.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/fec_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index b55d6ed9aa133..fb7039b001ef8 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3371,6 +3371,14 @@ static int fec_enet_init(struct net_device *ndev) return ret; } +static void fec_enet_deinit(struct net_device *ndev) +{ + struct fec_enet_private *fep = netdev_priv(ndev); + + netif_napi_del(&fep->napi); + fec_enet_free_queue(ndev); +} + #ifdef CONFIG_OF static int fec_reset_phy(struct platform_device *pdev) { @@ -3735,6 +3743,7 @@ fec_probe(struct platform_device *pdev) fec_enet_mii_remove(fep); failed_mii_init: failed_irq: + fec_enet_deinit(ndev); failed_init: fec_ptp_stop(pdev); failed_reset: @@ -3796,6 +3805,7 @@ fec_drv_remove(struct platform_device *pdev) pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); + fec_enet_deinit(ndev); free_netdev(ndev); return 0; } -- 2.43.0