From patchwork Thu Aug 18 16:16:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12947432 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 919A3C00140 for ; Thu, 18 Aug 2022 16:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I3uSU0aef648fZTiQk/5xP2Y0FTBnASit0F06wkATKg=; b=VZGB2EX1XqgJk4 phu/rS/LI/KOPvImymPXfiEDA/gNNC/jOurDoWKr3+tdmoMxYsvm89Xvn6VnD5Sx0TX/zqZ5kLVWM 0xPbWGdEENnWijFQVKQfy58Z1BHPxF0r9GbIuTUOlt3QMqmn3B5q/0SIZt9BVFBH+l56kcjcR6xpC JY/pzApBJTRRbqitNNltjTHtNEOEzg3AbEP/9WQJQvkVHILxssMIlDIz77g+wEwCwnsGqdXmSc9+W KgQkt2FNEhs6mOBc4utBNhdsdlrkqFgFBJoNrJbp5B6y8ZmU4nkzep22QCpDsA0DcjWW7BwCFQMxx rQ8LPehL7vHzzGfUZvkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOiSw-00793S-Ui; Thu, 18 Aug 2022 16:33:57 +0000 Received: from mail-eopbgr10081.outbound.protection.outlook.com ([40.107.1.81] helo=EUR02-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOiDJ-0070T3-5f for linux-arm-kernel@lists.infradead.org; Thu, 18 Aug 2022 16:17:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A4w55kNqjeik88HgVMYkmpIuOZsjbZftcznLqqbGQN678TEGnn0+frS8SHSIy5ruX8feG20gqIyndmKtVwESHBWqVf0ToiaFnkQUyYffpuVBaEw1nsQf1IO/mXwO7Ky92DFo3PIlLcJEjulWW9IK798a7bIFDy9fr+YHX7R50wgLvHzpe0lPv3xP4yNsWFIPkgnlDOlpLkXtyOLE6GVGze/YIlpoF4RD56m4b6eKy0IvESAMjSyW4XfvHJ0++kTRwRtpRuRo3iwtNBwC9SXZ7rnlTx/AHxJanGMd6SCoa3WOFRI1xXHpT8RvBs0Ni1hH96lbqvUVVHN10sBnt/dioA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=F39VOWHdbomM6yNOWWJ7eMkODFt7MS7bR17qY8C8kTQ=; b=JLQqN0NcZCZQbHUh/sLzBM0M0zI9RR53bP5NcvR5NPlKItWKBoBciilmYBUENhW62sM84c+VuZ4xMRiHPgVDxY3Ez1OjRBHU4Y1rUnJWnX8FWDjzJbGk+C3ycbNws+LMeWVRD6t7lAKjJaUs9Xpfei6w6HTXYWASGiNvDBLKMjz/+oHow9AaOvOiwaW6PF9yw9xtahdI6FCtfNO7jo10Wi0mi6J2idWB8ftgMZRO9MS1CJD4QOsWbBbzHRCF8jVfIDF6yMGVtr6HumoD9kbnx1Dk/lTzKNBoASGGTSkJTJGQc/WgFC2xSxg+/aH5Gmx+i3xk75NJ4c5uhTW9PyXzkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F39VOWHdbomM6yNOWWJ7eMkODFt7MS7bR17qY8C8kTQ=; b=0p5mqzwpPBXQ4SS8miLYY3eCyv6shh4+UnFNIbhklbcLCDg1rYARwwQRqVEK3V4BhgNLUgEHyq9TMUK/XRAwJVpaOIuexe14rU8lnknS6q2e5kjd1mrNPI81ffrGcgSJfR50JDi/49++6lHIAultfwFfD3pKf+cSsPg3GyzHGV4wcX1eGkNgxca2q9aweuyP3cOW7FJEohyEozgov3RqtjA62oX/ElkE7hVSg373xqrSyryEqDH/HKMclFjGrCfiw79CwwqsgTpUUEWrdfc74Q7B4JGIvdRCOJ7wN46ouax5fBZPnfxxaAyP3MG6Vvq/UvRK7dYy9OW8ma1dhf9/aA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AM6PR03MB5621.eurprd03.prod.outlook.com (2603:10a6:20b:f6::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11; Thu, 18 Aug 2022 16:17:37 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.019; Thu, 18 Aug 2022 16:17:37 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Camelia Groza , linux-kernel@vger.kernel.org (open list), Madalin Bucur , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Sean Anderson Subject: [RESEND PATCH net-next v4 20/25] net: fman: Clean up error handling Date: Thu, 18 Aug 2022 12:16:44 -0400 Message-Id: <20220818161649.2058728-21-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220818161649.2058728-1-sean.anderson@seco.com> References: <20220818161649.2058728-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0009.namprd20.prod.outlook.com (2603:10b6:208:e8::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2e4fe0a-df80-4e10-de74-08da81352a59 X-MS-TrafficTypeDiagnostic: AM6PR03MB5621:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /yXVOXKADuWAsmSsmXZgw4nr43H+NvmRuytgne7rhsYT1RcrUvmFYaPnjcJTJVdvLvqAt5JUek9eIYNFLWkj6g11LRhOaEirG1x9mkI3mh8MJRAib8LjvfI8tp9p3UVEsOLe4f5I7UL0KyVyV55O6XXFxkD5d1s1Qk+m6XcALzW3Qw3V2UPP0sZQiHiOuEGaOt6TI2CyoJ0VHQIZWvJDOlYHHpjrqwbnSpciprcW5ifq+Ps1s1CadQwLLl6KFHiJsZHnSW4AhugqGDxkUKfvdmPpKEtMFzosCWbVNXULLdlXmRRq2DruwSCPlhOiR8WOa6H9qr1rTOr25c/yZV0OQSEhXmkZBqSf4Pw/BMSAIAP6yUsypO1rXr3HYElT8p05LgTD78B06wHHRL8xgLVlVR9jr1kTXAngh/UWKgROuTD4RzxxSVPFNDTjJfPYB5hqmXvlr+V/ndy90IxYHofWgFwSSc+HOkaqSFDm96qxiwa3P2Iy8ZsuaBRNLVVPmYOxnnGkKT0pMSuscA0TD4Gd5sEhQi1rDh3oWhfvpxlUpdgqSg/NCjZoEomnjpX3imC9QXko56Pj/8So0imVdPjcM6+N4Kk82ADyxFOP1Fm6tfGiEU0OJ8MzXptNbYEXEmVNXIYT7/uW1deYifkwOEcUUikxn7/gb9zD0CiBC3xj4WcUCUeto/TE6CUkHlXKIpjihy36/z8y5R9UfWyKnSDUkvNh29WVF6gox14VgSAKUr7G1rIvw/9FbqJcEpEEuGlN+AFmcG+0vXrAyUXf67X5/A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(136003)(346002)(396003)(376002)(39850400004)(41300700001)(316002)(478600001)(54906003)(38350700002)(5660300002)(38100700002)(6486002)(66946007)(7416002)(110136005)(66556008)(66476007)(8936002)(44832011)(8676002)(4326008)(2906002)(36756003)(6506007)(186003)(86362001)(107886003)(26005)(1076003)(6666004)(2616005)(52116002)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f2r/OW356i1NL9ALG+IERHr78W4buFJ7WLhV9IkzBY7hhJiRTun/oH+/yt1anR9rlS2oqjL+ctXjtoe30a+K+c1oiQoZg1sAzG14fBxbPO3tTig3pKJbN7mCVGs+LS5Y2MpjYcgrKwmbgsEsTYTETC1ciq23tMGPfW6Kt0EiAJe3Wl4uGU39qMtmkABd69uqOp2I71fJk8Drs64xtfWRmH7UKRhqTVADdyzqPE0i6Jyftk1jBbXWkYryXEpqJPxdCThNxcVVoU5qlG7I9pYholDP6/48u+rCsSEYkMYzomxVQoe114CeApOeWJlsPqOiQqrN972FugAbs3DEbGVl3H219uJvBjHj+oMM3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xnhNyosyT62cNuE6KSh6lsSLmOjhGQvj/5ViFgVXA4ZBvWHZmqMokyHsB1E5cWWzNB7fJttu/8UPVzTtbjuzxFERDc83Bir0ZWhxJPnR5ETj4TBfXdy6ppOETENghWwmy2hfwb8Jpc19wxh5s256HIRhbzMj0rA136/sD26SICX6UInNbiTKYMg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2e4fe0a-df80-4e10-de74-08da81352a59 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2022 16:17:37.1847 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A/8EWccXJT1LcQletAebKG+o/d4QAVzcDdLjFlQdW2vzB6i7YFwRUykSfUtDTopGhcGX6Xkxa4zmI4a10/L2LQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB5621 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220818_091745_290190_652884F8 X-CRM114-Status: GOOD ( 13.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 This removes the _return label, since something like err = -EFOO; goto _return; can be replaced by the briefer return -EFOO; Additionally, this skips going to _return_of_node_put when dev_node has already been put (preventing a double put). Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) drivers/net/ethernet/freescale/fman/mac.c | 43 ++++++++--------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 66a3742a862b..7b7526fd7da3 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -291,15 +291,11 @@ static int mac_probe(struct platform_device *_of_dev) init = of_device_get_match_data(dev); mac_dev = devm_kzalloc(dev, sizeof(*mac_dev), GFP_KERNEL); - if (!mac_dev) { - err = -ENOMEM; - goto _return; - } + if (!mac_dev) + return -ENOMEM; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) { - err = -ENOMEM; - goto _return; - } + if (!priv) + return -ENOMEM; /* Save private information */ mac_dev->priv = priv; @@ -312,8 +308,7 @@ static int mac_probe(struct platform_device *_of_dev) if (!dev_node) { dev_err(dev, "of_get_parent(%pOF) failed\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } of_dev = of_find_device_by_node(dev_node); @@ -352,28 +347,24 @@ static int mac_probe(struct platform_device *_of_dev) err = devm_request_resource(dev, fman_get_mem_region(priv->fman), res); if (err) { dev_err_probe(dev, err, "could not request resource\n"); - goto _return_of_node_put; + return err; } mac_dev->vaddr = devm_ioremap(dev, res->start, resource_size(res)); if (!mac_dev->vaddr) { dev_err(dev, "devm_ioremap() failed\n"); - err = -EIO; - goto _return_of_node_put; + return -EIO; } mac_dev->vaddr_end = mac_dev->vaddr + resource_size(res); - if (!of_device_is_available(mac_node)) { - err = -ENODEV; - goto _return_of_node_put; - } + if (!of_device_is_available(mac_node)) + return -ENODEV; /* Get the cell-index */ err = of_property_read_u32(mac_node, "cell-index", &val); if (err) { dev_err(dev, "failed to read cell-index for %pOF\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } priv->cell_index = (u8)val; @@ -387,15 +378,13 @@ static int mac_probe(struct platform_device *_of_dev) if (unlikely(nph < 0)) { dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n", mac_node); - err = nph; - goto _return_of_node_put; + return nph; } if (nph != ARRAY_SIZE(mac_dev->port)) { dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { @@ -404,8 +393,7 @@ static int mac_probe(struct platform_device *_of_dev) if (!dev_node) { dev_err(dev, "of_parse_phandle(%pOF, fsl,fman-ports) failed\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } of_dev = of_find_device_by_node(dev_node); @@ -465,7 +453,7 @@ static int mac_probe(struct platform_device *_of_dev) if (err < 0) { dev_err(dev, "mac_dev->init() = %d\n", err); of_node_put(mac_dev->phy_node); - goto _return_of_node_put; + return err; } /* pause frame autonegotiation enabled */ @@ -492,11 +480,10 @@ static int mac_probe(struct platform_device *_of_dev) priv->eth_dev = NULL; } - goto _return; + return err; _return_of_node_put: of_node_put(dev_node); -_return: return err; }