From patchwork Thu Jan 13 08:55:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 12712465 X-Patchwork-Delegate: johannes@sipsolutions.net 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88683C433F5 for ; Thu, 13 Jan 2022 08:57:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233232AbiAMI5s (ORCPT ); Thu, 13 Jan 2022 03:57:48 -0500 Received: from mail-dm6nam11on2047.outbound.protection.outlook.com ([40.107.223.47]:10080 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232209AbiAMI45 (ORCPT ); Thu, 13 Jan 2022 03:56:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D/ltJFlSR8DD2TexN/YYefeS1j3PCs/qa+/yxcQuPwvKzxnRHj3L1EWWgT+gRvmxQ1lykRWp4IYt5zugv/cEQAtJpTy4S6g06adpGA7EYhF4nTHqs55JkZT5B7l0eCzTmj+2IfKRPGqwd30d5HKgDYLCoZmU4INysWEB7QUDZXnUighldl/BbIA6fjrd4lcRF4Ks1k1YIdGBHwB3DC9/FSmHzLFLxovyai9CpsYzdDiRQ2FRZFBOOkFPcRsQJmxITcaWfSkU9eCKg7iOim8ufc5mWhBxC6zbkkZsrG7uMU0S2sS3YK9FUsLRRbcU1x1mP29xvJFOghBzXbM938Murg== 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=XiIr7gy9KeHlgbSlVN/Qd+VHZJQtENGovsSdj9Qff/I=; b=TX9cg82U97/SVCgSMTi73tZVVVQDenmVlzyRjkOiTD3Wh9Nv8DW2euZ2cJoScUTa6vHkA0f2u3vyFTgcjnYybpR9wH1LXA4lHIvqHtWQWOUBtaOomedMuVZMF+EelgehL98iPZAkhhP2w391sMBquAUpBEpC8OhACrG20zAYIvA7M88FR7l6vR6cKP3Y7kF+yxGSAGmMg3RKezk8x7lNWhJ7PwOJBXnbhCBJ0/wgm2you+n9TK1SRdpTUwkk2esBqfDtXCA8dl7h3nP0bzllEe1+MZVDJasyiXAGnfNx7I95HYnhmxAtnwIsYBrUE4p1zNxMPp9tEAwaoBDZ+GGPNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XiIr7gy9KeHlgbSlVN/Qd+VHZJQtENGovsSdj9Qff/I=; b=GBjx2fbp+ssyLEnszIHBvr5EnlNaGO8eRSU8XumzismdSeLCrcspUvKcZVBseMspbqgywl1izMHztkQmorlts0shLrqOncY1L+WaPKvdoURbAnVeSl7qgbcN0SFA8YMWv0d03VnN/OY8fiV2wYB3gACFh6qDSOnIs+Rc/azJckc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by CY4PR1101MB2071.namprd11.prod.outlook.com (2603:10b6:910:1a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Thu, 13 Jan 2022 08:56:24 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::d031:da9e:71a:73e4]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::d031:da9e:71a:73e4%5]) with mapi id 15.20.4888.011; Thu, 13 Jan 2022 08:56:24 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 23/31] staging: wfx: use explicit labels for errors Date: Thu, 13 Jan 2022 09:55:16 +0100 Message-Id: <20220113085524.1110708-24-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113085524.1110708-1-Jerome.Pouiller@silabs.com> References: <20220113085524.1110708-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SA0PR11CA0117.namprd11.prod.outlook.com (2603:10b6:806:d1::32) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d453a22-20c9-4dcf-064f-08d9d6729396 X-MS-TrafficTypeDiagnostic: CY4PR1101MB2071:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:398; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WzyNLJ2KCDECLpuxXXPjTkSNDmmz2dEY7thSrB+vbgLbd8bdfVW96Cs1V6ZM2JJq2PVhmjT7jLlI7/VMrjKAWA+EMmToviG1gB+fji01n77yQqwIkc+RlBTHTCE4nwyAJQAVWvfDYpcay5ytZ99RIblsx13JPIbTq0DOQsYO6zL3/FiA61E5XOEfcCBOd92HNMILAH98Q1daarIS+xBeawyB1COhvdsrKO7YlWfUvp/U+XyWEGljgwnG8Xb/ExvMNnXfqjU7Zdb2x6ShaX1/BCgB1BzDOX49mOZVe35iCuTBzpcB5fD6v3RlR+dzpBLrUoaQFxX0N+uNxIycyvYoa0zf7BrcaN5Mc8ZfIFixba3lMJ2OxBOM1caSFnBJKhrY6rwHnIBuCKo6pBMHOjxZ7BxFvohMCF6I1x9VOJXLPXoFZZa2QhlpTWBElV6TEjwSDKDO24idj0u0Ejaqkgrj/DOgfMDjD1x9zI878EedHIy0S5t7tLnVvPw8pBq/W6SuGVBP/vDGr9VvFO8u8eZVp5c4zMz6A5uhRxBVNp82pB5wMzn26e2YbS1uTeeZgfJ9dSUVvl6u2fZggCFNXZnKs3Q0P5lDVOfqEUbvi5fbcLUCbsISdl1bCk65GrN+AWnRzOrGAzoXoKlST+X5R9rTzw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5657.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(2616005)(66476007)(52116002)(8676002)(6486002)(4326008)(38100700002)(8936002)(83380400001)(6506007)(107886003)(66556008)(6666004)(36756003)(508600001)(2906002)(5660300002)(6512007)(1076003)(86362001)(186003)(316002)(66946007)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wWWJRjTyVTSoATVXvYaWGKQQSMYk?= =?utf-8?q?xFNdllEgjfK5Pxv0g0xi51OFp7mS6Gs7+B59pqTRB+bYkZylk8AG7jVFDOAy2GMa0?= =?utf-8?q?LUs9Bt7u6VQK1E9nUb29NPbNLdzZSF2yfNuHVykcUAY5IUVq0kH10TLYFy8zzEHrl?= =?utf-8?q?p4Q3F5DQvjflgRi6QUdTCG9Ycx9s40Cmgg1uW5UWNQrjc+VVvldYvMIJPRqgAqmlO?= =?utf-8?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NYEajGCEbJGMOpXNnCMHOD0PTIw/qnk1ZmI6tTJy02PK2KkyTwlYmzJQ/fLygqb?= =?utf-8?q?HPhAIFXPfN75Le5W4CPJzmQFVA6eOUI0+4t7gWO+CxrCP+7AsC6sOsvqoEdmU8P3D?= =?utf-8?q?dOilR2w0dGbcQO5w19Ir2657CJx/5YgWgrz5nle7BP1V1mEoiEd+aEjc8QOTHpVFX?= =?utf-8?q?xDZ/dk3Dq7SclUcxiAVqrxy/IFRFpWJneCm3CjsrBg5Z33TDRSGerdE+BeRngbg/H?= =?utf-8?q?P4/ivctJbyR9R8qIIN5NLHuPTQ83OWJgQjpcQURthxVOkqQRWGGKw560Q30ykclwU?= =?utf-8?q?z9v5pp3C3g/aH8I57p5vxQ4CymaM297FhFmTUquFPFol6U1OsYPE0fB5J7Q33igbI?= =?utf-8?q?qodhs2POuLUNbxj0yj9UsO3Wfa4z6NHK0RSxKGj0qo5zRNTWSNWmluyBPKGDWu8Xb?= =?utf-8?q?MRAOV7C6wnZ38l0XCTN2MypOKvgwUpE+H2qZ49Y1/ipiTFvmU+k1EylBw731TXEE+?= =?utf-8?q?MuQInIUGtGKMMEQoTKtjy2yJIicMUMpzMJCPwCbhjWttyeDppePj7U=3D?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d453a22-20c9-4dcf-064f-08d9d6729396 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2022 08:56:24.3771 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WaQzRJmpWuk5LU1vtGWZuldpYkpc5WlYRT0EUEO24sV2WnzaQOaNkhCSU/bWRhu8bvm007k/tObpMtt9Cw2QOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1101MB2071 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Prefer fully named labels to handle errors instead of err0, err1, ... Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bus_sdio.c | 9 ++++----- drivers/staging/wfx/main.c | 31 +++++++++++++++---------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 4b77df2f463e..5c45ccd85a7d 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -214,26 +214,25 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i sdio_set_block_size(func, 64); sdio_release_host(func); if (ret) - goto err0; + return ret; bus->core = wfx_init_common(&func->dev, &wfx_sdio_pdata, &wfx_sdio_hwbus_ops, bus); if (!bus->core) { ret = -EIO; - goto err1; + goto sdio_release; } ret = wfx_probe(bus->core); if (ret) - goto err1; + goto sdio_release; return 0; -err1: +sdio_release: sdio_claim_host(func); sdio_disable_func(func); sdio_release_host(func); -err0: return ret; } diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 217c0c5c60d1..46fd5702e471 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -232,18 +232,17 @@ static int wfx_send_pdata_pds(struct wfx_dev *wdev) if (ret) { dev_err(wdev->dev, "can't load antenna parameters (PDS file %s). The device may be unstable.\n", wdev->pdata.file_pds); - goto err1; + return ret; } tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); if (!tmp_buf) { ret = -ENOMEM; - goto err2; + goto release_fw; } ret = wfx_send_pds(wdev, tmp_buf, pds->size); kfree(tmp_buf); -err2: +release_fw: release_firmware(pds); -err1: return ret; } @@ -350,7 +349,7 @@ int wfx_probe(struct wfx_dev *wdev) err = wfx_init_device(wdev); if (err) - goto err0; + goto bh_unregister; wfx_bh_poll_irq(wdev); err = wait_for_completion_timeout(&wdev->firmware_ready, 1 * HZ); @@ -361,7 +360,7 @@ int wfx_probe(struct wfx_dev *wdev) } else if (err == -ERESTARTSYS) { dev_info(wdev->dev, "probe interrupted by user\n"); } - goto err0; + goto bh_unregister; } /* FIXME: fill wiphy::hw_version */ @@ -380,13 +379,13 @@ int wfx_probe(struct wfx_dev *wdev) if (wfx_api_older_than(wdev, 1, 0)) { dev_err(wdev->dev, "unsupported firmware API version (expect 1 while firmware returns %d)\n", wdev->hw_caps.api_version_major); - err = -ENOTSUPP; - goto err0; + err = -EOPNOTSUPP; + goto bh_unregister; } if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) { dev_err(wdev->dev, "chip require secure_link, but can't negotiate it\n"); - goto err0; + goto bh_unregister; } if (wdev->hw_caps.region_sel_mode) { @@ -401,12 +400,12 @@ int wfx_probe(struct wfx_dev *wdev) dev_dbg(wdev->dev, "sending configuration file %s\n", wdev->pdata.file_pds); err = wfx_send_pdata_pds(wdev); if (err < 0 && err != -ENOENT) - goto err0; + goto bh_unregister; wdev->poll_irq = false; err = wdev->hwbus_ops->irq_subscribe(wdev->hwbus_priv); if (err) - goto err0; + goto bh_unregister; err = wfx_hif_use_multi_tx_conf(wdev, true); if (err) @@ -444,19 +443,19 @@ int wfx_probe(struct wfx_dev *wdev) err = ieee80211_register_hw(wdev->hw); if (err) - goto err1; + goto irq_unsubscribe; err = wfx_debug_init(wdev); if (err) - goto err2; + goto ieee80211_unregister; return 0; -err2: +ieee80211_unregister: ieee80211_unregister_hw(wdev->hw); -err1: +irq_unsubscribe: wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); -err0: +bh_unregister: wfx_bh_unregister(wdev); return err; }