From patchwork Mon Oct 7 15:06:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13824901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F90BCFB446 for ; Mon, 7 Oct 2024 15:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vLyN30bJzNuhmIRRGdJUrSTAkk8c7HWdgEAlsDDTxX0=; b=TaDjPjzsb2DvsR3Rk3SFNxoyLU BuyxbVt3EoXdkX8wFQzeugMLfwQaC0IFx9ZUGXwcpqi2ADwWFk8QCqFh/GbFVEA3EJseWjc5MwFi+ 3zq6vPrilN2F4dqEMnU/YGZ3WovpWMNPwMxs9on4+QsYbEgnWwGsqte+3G/e44AyIesupGXa5UshJ lfrzOoZ8TUgYNBXXGM/vUJ+1COncKKe9ch+qGAD69MX09mWeDtYwF9ntr7eB1/finEEhSS4pI2o6q +SwcgAEouioUhI4Y6JxRBVpMkB789cBfq98ywGPFkzn6nyEoj//VmgvpnBMXClOyVr+I2LCF6Ar09 PIFB2Zug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxpPV-00000002tet-2iOV; Mon, 07 Oct 2024 15:12:33 +0000 Received: from mail-bn1nam02on2060f.outbound.protection.outlook.com ([2a01:111:f403:2407::60f] helo=NAM02-BN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxpJn-00000002rwE-35lq for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2024 15:06:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FQ10TH89QnD2vT9X4pObjxRrG9aQenGcX5+j7esCSe0Xe7rcpkAME0CrHPNFQhyWCkVgEeELVnuqyE99JaJYAmpy0qm8APdnUUpCvnazBu3Vq0RiRSS9Alezt26fOK4iwVYPpgncefX1Ki/qqtyBIhqUhW+gtUrTWOEAKs8xlXNRMG1kWFPNmd+/gx4QSRyksACkdpAIo6rKEaIaBGiEXaqmEUmqy2nS7ZUTKpAQISVc2+B4uGSvmWNCNw0CNW5RS4V9gx7Ud/T0cSURndSF4Mul68y9nY2dR1H9M021FaQ/LdSak/nuU5v0JcDcQMJJuUkBbWtwdsHh+zI2po6aEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vLyN30bJzNuhmIRRGdJUrSTAkk8c7HWdgEAlsDDTxX0=; b=D7LNK1phztLaVdgWlmz0eVZHPWfYuRGdS/VgFjNRhRpT59W6FKiS70jbLNOwUE2Dx5euJ9SgjlDZM0JWh1NVgRujVAE48ZtaNmLyHDeuUmsRT7zSckwRPh2aL3d9fdoK+iswz8/KawZLtrXdI/ZQQUB5IG7WAOoO4PPorY6xC20rq4ksF8wElZvlwmM2ANRjeBp8FElrV0iE7gtPnx6hoy0rua34/XAh/RMo3z/wKc1qwT5owu6RGjBI+EcG8NKzbdiX7L6m/LG20oPx+jpNW5SWxYz+0STFsti2viK2+m8WULUGKD5+q+Pzh+noPi7TcUN56mMat72TPcrvrbB3Ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vLyN30bJzNuhmIRRGdJUrSTAkk8c7HWdgEAlsDDTxX0=; b=nryH+0X+3g2oLw+EHYcYMjqmJZyzTn0bAjG2FdvcrHLfdEJCevP8HA00cMd/XdOlgEr8m0VYgKGYFpU5uHdlHSxAQPUBp6o3m4t3HFI9lpfiJN4/NfSSoNKQIBi/UXObcL2siE4HZcJPz7xIie2ehz9kDOYZVkjdczWkMUEGAY4= Received: from PH8PR05CA0011.namprd05.prod.outlook.com (2603:10b6:510:2cc::28) by CH3PR12MB9027.namprd12.prod.outlook.com (2603:10b6:610:120::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Mon, 7 Oct 2024 15:06:31 +0000 Received: from CY4PEPF0000E9DC.namprd05.prod.outlook.com (2603:10b6:510:2cc:cafe::80) by PH8PR05CA0011.outlook.office365.com (2603:10b6:510:2cc::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16 via Frontend Transport; Mon, 7 Oct 2024 15:06:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9DC.mail.protection.outlook.com (10.167.241.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Mon, 7 Oct 2024 15:06:30 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 7 Oct 2024 10:06:29 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 7 Oct 2024 10:06:25 -0500 From: Radhey Shyam Pandey To: , , , , , , , , CC: , , , , , Abin Joseph , Radhey Shyam Pandey Subject: [PATCH net-next v2 2/3] net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev() Date: Mon, 7 Oct 2024 20:36:02 +0530 Message-ID: <1728313563-722267-3-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1728313563-722267-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1728313563-722267-1-git-send-email-radhey.shyam.pandey@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: radhey.shyam.pandey@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DC:EE_|CH3PR12MB9027:EE_ X-MS-Office365-Filtering-Correlation-Id: da40e6d3-0e97-4238-fa13-08dce6e1a034 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700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ELS2Q94UjZqZkNi+B1JBzSIfnRSkDtVHvd5nM+pMI7rwNcxgcJeBuqTkeCMkiV9aw4NhE0/bYJLowlLBp1eLUKt/sxBCWfLJl4xqVW9IgKLKf/F1OFTmk4XskRDlLxAaiMNo+aamYMYzg7gSAJ2Dy6FD25RZOnl8GjANJrgwBcKr19S8+OB/HXwqR7RauNANDlsrBlSwbNJu2wu/NjZHosVbZSHFHm3/2J4qffdq+v5o5qkWR1TSZBeFpdcF32WE6eQBQUhyl3k9Ci7NPBvR6TShBxCuLLLd40qArkfSpAFtiQOXPJX+Hyitmexn7wZIgft250riBqKk7c+6pDH7/aJN8egSRolTUwsnp0BpIY2k X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2024 15:06:30.8061 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da40e6d3-0e97-4238-fa13-08dce6e1a034 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9DC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9027 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241007_080639_823029_7BBA17ED X-CRM114-Status: GOOD ( 12.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Abin Joseph Use device managed ethernet device allocation to simplify the error handling logic. No functional change. Signed-off-by: Abin Joseph Signed-off-by: Radhey Shyam Pandey --- changes for v2: - None. --- drivers/net/ethernet/xilinx/xilinx_emaclite.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index 2eb7f23538a6..418587942527 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c @@ -1097,7 +1097,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev) dev_info(dev, "Device Tree Probing\n"); /* Create an ethernet device instance */ - ndev = alloc_etherdev(sizeof(struct net_local)); + ndev = devm_alloc_etherdev(dev, sizeof(struct net_local)); if (!ndev) return -ENOMEM; @@ -1110,15 +1110,13 @@ static int xemaclite_of_probe(struct platform_device *ofdev) /* Get IRQ for the device */ rc = platform_get_irq(ofdev, 0); if (rc < 0) - goto error; + return rc; ndev->irq = rc; lp->base_addr = devm_platform_get_and_ioremap_resource(ofdev, 0, &res); - if (IS_ERR(lp->base_addr)) { - rc = PTR_ERR(lp->base_addr); - goto error; - } + if (IS_ERR(lp->base_addr)) + return PTR_ERR(lp->base_addr); ndev->mem_start = res->start; ndev->mem_end = res->end; @@ -1167,8 +1165,6 @@ static int xemaclite_of_probe(struct platform_device *ofdev) put_node: of_node_put(lp->phy_node); -error: - free_netdev(ndev); return rc; } @@ -1197,8 +1193,6 @@ static void xemaclite_of_remove(struct platform_device *of_dev) of_node_put(lp->phy_node); lp->phy_node = NULL; - - free_netdev(ndev); } #ifdef CONFIG_NET_POLL_CONTROLLER