From patchwork Fri Sep 16 19:13:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12978805 X-Patchwork-Delegate: kuba@kernel.org 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 244E3C6FA82 for ; Fri, 16 Sep 2022 19:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbiIPTOJ (ORCPT ); Fri, 16 Sep 2022 15:14:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiIPTOH (ORCPT ); Fri, 16 Sep 2022 15:14:07 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2131.outbound.protection.outlook.com [40.107.92.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CE9CB95BE; Fri, 16 Sep 2022 12:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KyMiUYS8c5NRCml19fM1BlWFkmiLzXtTpjDfjwlM0F8nqwdcl6qvASIyt94cV1LWxiLh4C0YZ6tvR4O6Mw2GaM2RxFPtDLhLtc2ZvKVYNA9Xb0wdU9HoWM/g5ZeohkRKDg4Rb8dhmtQXI+DLLoSN6CT5ffM6MIo5hGC9S3JRPpHoy7rK8QylyGRqhlrmekWKSSlL+faiF2pd3hCEMY/7ddSFQr1FFcqoAhI5KRuMUcKS6aTOY5JCChDrWzDYPBlbOUpUvP9KBUNREn1edcvtvZEjTPvART41gLIn5yHjrpejIiHPzFSawxBhL8oLmU9uGtjyrP9H0JZxTlcqor05Ww== 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=UJIKaxTzzSw8cnqP4ZShA8X2sgUoJbY5qtHCbUbPKu0=; b=fkUSZwYgt3F0jzJmwP976hm2Qv9sGCl6ria427JWlfr/YJDto598A2nFw+BCuOX57OSFqgKsHv+2B4P3YJFEed/vxZoLvGM2dK23VZeCo7DKlfNC+RrFqrmSQl/NEro4ugk2XCrooh7QnJoMXlkmHj5zI0/QqXBv42ghRG98rf8RXFJTtFSEefRgC4d8+JJwTKMwyMZpMiLim5MSGl+DCZufgYxMvuyHjj26jseZEto1Y9aGFADZVZzzpZQ2XJRHN5viokyRA/NG4+wNA8Xgmu+rRxEOSEM438YbcGPMNiRo454iC8ZqEQV4csUxr+7VRC3iSky0NKnlXe8SFunMHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UJIKaxTzzSw8cnqP4ZShA8X2sgUoJbY5qtHCbUbPKu0=; b=qed+chpos+TrMJkBn4g8SrKOaeCz63AmB8AGWvU89jYfJmK3l95NG2HHo8VQ99lOQi/Zq/AFV/dbyriBIr9sElci0hF3jSow2fj9IvxfTGliwc1qjx24SE4SHd+6VQ7yxwqLQ1cSA1hLHjG+vdH1PHS43PScZIHDG8zv31pGdfg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SA2PR10MB4492.namprd10.prod.outlook.com (2603:10b6:806:11f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.17; Fri, 16 Sep 2022 19:14:01 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::dcf2:ddbd:b18d:bb49]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::dcf2:ddbd:b18d:bb49%3]) with mapi id 15.20.5632.015; Fri, 16 Sep 2022 19:14:01 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean Subject: [PATCH v1 net-next 1/2] net: mscc: ocelot: utilize readx_poll_timeout() for chip reset Date: Fri, 16 Sep 2022 12:13:48 -0700 Message-Id: <20220916191349.1659269-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220916191349.1659269-1-colin.foster@in-advantage.com> References: <20220916191349.1659269-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BY5PR04CA0015.namprd04.prod.outlook.com (2603:10b6:a03:1d0::25) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2351:EE_|SA2PR10MB4492:EE_ X-MS-Office365-Filtering-Correlation-Id: df35bd9c-b11f-4e2e-a15e-08da98179cfc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A+oGlCp/9vv11v2RepUb7fL/xvc9AAJmndu0RaT+joZ3upmVRV4lT73EkAyDeH0UWcviSoESCC4dJjdmBxhGI8NVBNTc/FT1O4o/8QVXYbjd9qd1pOJw0CsTiZyMftF5lm4ccHO5B9tF5ozsvtMEM03sxn5g+9N0wkgysPY6H4eh3ZF6MKoxXZAZXW6SvDB2d/RLwueu8r920eNAjgRP0ZjXKF1GXuAYSSK/L/44/jvwmR47PHj2zNETf/xBjXSTN99NpDUKexvpQ3vhJHN6hwnoWy4O/iiuDVNoPoj9CjtEOr+Kozc+FCPSmh7sUDCEVVTADUHa6dLojyiGUHcTEB5muPIBHn7VVgWOY0dYJCfuvaHXckkl18B4DGbXpxDD6hr7bnSJd6TvvUoG2du5toMZSKz9yxJER+t32Ezy1KOfMN1cHEGYnSyxGGhC10NkzVDadVqigDx0wO7J+Fhw+ZznZJV+w2Io9J8LZuN2MoshZtLmyWIsYXSxGflfctjE7IVQHqoFPpNtXFwFzKd6bCO2IoxAq7Egqv3ODvID/6rShMr4/qsPcL3QYBckzJC+8Gwqbm3Dktq9HGhQKPvQyGi+7cgVcIrBVuwTdHEmZpxvZuJgU3OTCObxDyOHLYXDll2jBeeCuK4Uh1FBKEL8rrwlWVLhJ4WgFYA7cgINTyjwgq3xSmGXZQZeSvE29ltS5tu2V8iTO5iP9psc8hmJXQf4/HUJodf0dC2n4sax74AY62AO4NyccsUZnvzTgTGMP6ESIs8rDArsObBbnIZSyw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39830400003)(396003)(376002)(136003)(346002)(451199015)(38350700002)(38100700002)(86362001)(36756003)(83380400001)(44832011)(6512007)(26005)(2906002)(478600001)(41300700001)(186003)(6486002)(6506007)(2616005)(1076003)(6666004)(52116002)(4326008)(66556008)(316002)(54906003)(66946007)(5660300002)(8676002)(7416002)(8936002)(66476007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YjCzXdVLlkvA1jGqvK3JvpgB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TRUNEzOhQUoxvaLh0hnUG1bq5ODvy8sBtoBOhh1ElWkkT67sFykgBRf1eAghQ+6ptDkupcRxjihaZhphfkSilHQId706lQVlX27R0K/F/FKqxjI+boB09eE51cHrFFOrURe3m5tKzq2aBmNgi3KoVIij2gpKtdarcCDtWzu2HdopRWtCawZCu+N1O9QEZybEq0yDcCGZaPAhPg8U8umvVrZWsf9EjH4BlJIxf8ACHXmuiyw5T4O5eRDjJvg7PnSyuIBEJT7d39HQPO3pdZxtWGJqzRm6hrXl0ZIs5+WMDicQEK5iGcX4DPFPvN9NCU2qoIf16dkqZ12Zx9gzVgfiuczMp2+eRhIDPHg5rqz2rm3prkS8fdBb5tCbX3yqUZ9Y1tBNKBTMTlXBrfuUytdxi4mco037sEuaGYqnHFTBga4QAKWVDmnKTvodNWlf2+IYlnOYZHDehx50jwzmpYKqg0mOJOiT/7Kj4Cy8sRBDG1zam9w0p38Nm/u2L7X4hqYKn7vsPaVCFTxTmQUZuwgInR8rpDm2M= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: df35bd9c-b11f-4e2e-a15e-08da98179cfc X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 19:14:01.3693 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Oc4qf+GjUt2vq8eXGm4ALbR3ESGs+Pmv4DaJMP1PZLd7jIXwk7gBEyf2DyPnaNvUDXiU4Aw2+yBvmqzLS8HMrzu7uzMzXkHFcPhWWaLAE2M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4492 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Clean up the reset code by utilizing readx_poll_timeout instead of a custom loop. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reported-by: kernel test robot --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index ae42bbba5747..79b7af36b4f4 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -6,6 +6,7 @@ */ #include #include +#include #include #include #include @@ -25,6 +26,9 @@ #define VSC7514_VCAP_POLICER_BASE 128 #define VSC7514_VCAP_POLICER_MAX 191 +#define MEM_INIT_SLEEP_US 1000 +#define MEM_INIT_TIMEOUT_US 100000 + static const u32 *ocelot_regmap[TARGET_MAX] = { [ANA] = vsc7514_ana_regmap, [QS] = vsc7514_qs_regmap, @@ -191,22 +195,32 @@ static const struct of_device_id mscc_ocelot_match[] = { }; MODULE_DEVICE_TABLE(of, mscc_ocelot_match); +static int ocelot_mem_init_status(struct ocelot *ocelot) +{ + unsigned int val; + int err; + + err = regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], + &val); + + return err ?: val; +} + static int ocelot_reset(struct ocelot *ocelot) { - int retries = 100; + int err; u32 val; regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1); regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); - do { - msleep(1); - regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], - &val); - } while (val && --retries); - - if (!retries) - return -ETIMEDOUT; + /* MEM_INIT is a self-clearing bit. Wait for it to be cleared (should be + * 100us) before enabling the switch core. + */ + err = readx_poll_timeout(ocelot_mem_init_status, ocelot, val, !val, + MEM_INIT_SLEEP_US, MEM_INIT_TIMEOUT_US); + if (IS_ERR_VALUE(err)) + return err; regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); From patchwork Fri Sep 16 19:13:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12978806 X-Patchwork-Delegate: kuba@kernel.org 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 DAB74C6FA82 for ; Fri, 16 Sep 2022 19:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230247AbiIPTOL (ORCPT ); Fri, 16 Sep 2022 15:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbiIPTOH (ORCPT ); Fri, 16 Sep 2022 15:14:07 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2131.outbound.protection.outlook.com [40.107.92.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10B15B69E8; Fri, 16 Sep 2022 12:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TYFWIIkGnLv7eF1ReXqoBJZLurZd/TC5I+LZyKZjbxeONU5B/0cUZZbehAypGn9x/D/mUZcQlKb4gtVxD5CIBQGtk/0pQLSwFX617CuVt+RYnehrPo8cD1cRQqE+N75Z1hz+1hr9VDoB0EjAc4dY9f6fZYmTkactqlmcduYXjyIkP4WLyZmrbvmRfNSpb52x4mBH8tC1bv7xgmAz1p7V6IIeBn+NaUVlOsbkLgfHUJZnnwpYLLAhB4ssPVh7KRiE4qieqyvYAq8Y5ugXUERnso1OSWl8GwrINyGi3kk9kQQ3psR7MOCc59gBowkvTZZ72DlbKphPXJfZMJnM24cVuw== 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=QQJtY92j5G31CJOHMSXKNG3/wl4hoIXt7ILl9pSfxLs=; b=kfBrqdhpB4Axig2gS//x+Bpaah5vkFv1qe1JFznX12w8j2qBpZxJ2b9YrHDRHlEBLZVQK9P/eMimIfpYtkWzYoXe2Vv3jEA6fYaEm00+IZdllWTJP8/fuPFp0f1hQ2zE6fanl4z1qHeHo7yzsZLeAvAgQaE0STgdfZ1S+l0Qv4w+pNbAUkbCc68V1qSQ0WOH/kditP2Ty//fbG3XTOHjeLuuhEOdBWhTWH7ZoCvZapVFMVqXxiwSBEHVO//ORURR6H2arEWBW7Or2HBDys4QWCSyv8hKfoi6vBv4aGkYmajMsgJcnZj0bXdunBvHG0+FS6VjU9rxa6f+RP89Rxg9lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QQJtY92j5G31CJOHMSXKNG3/wl4hoIXt7ILl9pSfxLs=; b=FgTD8B9BGRIZZVC5Y+JcJUiBzYi1U3E0TpXIQUpCuOktpU8Ds4xgPr1d0YgRlZD57mdyTR9wEK9HwEURxHJolnJxm3x7RsFySLUp75Ff+xInZMhCFYlFyKIr0g2MA375U7ff8/1QfWb7LCbi0PwEYkFtwJylLt9wLzxwtmIHtwk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SA2PR10MB4492.namprd10.prod.outlook.com (2603:10b6:806:11f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.17; Fri, 16 Sep 2022 19:14:04 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::dcf2:ddbd:b18d:bb49]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::dcf2:ddbd:b18d:bb49%3]) with mapi id 15.20.5632.015; Fri, 16 Sep 2022 19:14:04 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean Subject: [PATCH v1 net-next 2/2] net: mscc: ocelot: check return values of writes during reset Date: Fri, 16 Sep 2022 12:13:49 -0700 Message-Id: <20220916191349.1659269-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220916191349.1659269-1-colin.foster@in-advantage.com> References: <20220916191349.1659269-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BY5PR04CA0015.namprd04.prod.outlook.com (2603:10b6:a03:1d0::25) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2351:EE_|SA2PR10MB4492:EE_ X-MS-Office365-Filtering-Correlation-Id: 43b3784a-0cb2-4339-d24a-08da98179d92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: byg+NZKnIrwPcz6Gt3gpuOlv3HXpQatHB9h2i49ItldO9m9gNmB/FJWuq5+FMff6MOng4PplcsUdnQxB/PAKZaR26eR6KsxumMKCCBFr97TGsQG8bwa3ogbGKwogHiSAbCzc8CW1JAWuGG1ZrjhvS5y2oNKe2QFLDLN13ir21tEdu9kJajd7Z6qYhV12x67oN69BOZ/bLIRCoj5C1BP7ldaUeul/Cr0Vwuqzv4X92DOiSLkklarrL3RPVc5JuUiXzS+1KZYrXLoEfHrjl59KWB75UXMIZ5AUTU2QtbE11bBchHtWdzpFF9bLTh+bKWZ9TPmha+kDUhy1MtL0gniV9W9w6pyizv0YYdXQBWuN3CM0gTLo+1hWyccTEx71qJ9/zX0N90RN/qmBuVzoKVGmWhZ+42yzN57oU3SES4JHSKMjDkB/3pDSuq6jJZJK61ucqYbwkWjVCJUT88+cwiZ5lm709TTByzT+Di7vNbNHqfLm3KDWVkSBS34bIQLeF+z02bshBjMiFNykyVm7QdtFws3cZNVNebpFZzi8vv2eTCKNBVMgZzMcCW2GEDBJbfRw5+NgHz2Za/mImETEzVP2y6KTJRyahQyBRUiiz2hkda7TZpnt8i/5ArMhivHdmcrcijJfCtjouU4Vhccp+dQ1b5SytlZ8G/tyD+9Il6Ck5WwNvDEgj7iwOGtd4+MmMMAAwATB6rTqe/XEXiB8hYTEVx/9eaZ20YieX5C/baLVIYgIaLO2d9R980MzNrr0WXkXIh1X7V8WJlR3qx6qmjVZmA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39830400003)(396003)(376002)(136003)(346002)(451199015)(38350700002)(38100700002)(86362001)(36756003)(83380400001)(44832011)(6512007)(26005)(2906002)(478600001)(41300700001)(186003)(6486002)(6506007)(2616005)(1076003)(6666004)(52116002)(4326008)(66556008)(316002)(54906003)(66946007)(5660300002)(8676002)(7416002)(8936002)(66476007);DIR:OUT;SFP:1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bGs1pLaAPOH883TBgkkyDKELJ9AMxoS5Hv0A1eViFnt2dIuUclQ4GgOS0vYqBWq5ao9crRopVQhGRlVZPNUvugPp+lH3+osnBcUVgtZwfKVaJr0Y+Vd5nUXSTGnlLzhD5LtU5f5+DjOklFXLFFFxfTCsl3GhugPpCJTyLZ6/G1Hd2RB16NJ8FJCpmw5fAUvCulosaa0SqWVlnBBUSvhYsMj0BkAcZG3vB4I1zsJXAnLY+DZTu7kj2oKF+l9nM/c1Au/jE8bfsxruMVBqCUH+H6WCx8oCgZjbPaA4lrIV01EJ/fRhNzK9mDl3qAGj6n+7GtLS9anB4hBHDf1zxGbFjDzOWk1kxf7S7fpkRQYu4caARYFE2uUlCQxxObLynIC+Lp/jNSiLtnZ/fscno+zOWJR8QIUYDcI9XPJ0ovJMccTJDmzIdEME4zf/XkzYcy3yrU1H6qf8UyFUi3PG+5MSR3te1O1uezA1yMl0PInsXuNQ1NYJ8KYL0X/mshJmQRBbG55HyvvvbZ7sKtgBsUJMXnICkpe+HUJkDXqmWKTZ20biV1xbguoWqufshCHmFhMb6m0spA6sihyIb3rlFKbBh+VyebY+AiqYv3wSicu71/KeankyzV8= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43b3784a-0cb2-4339-d24a-08da98179d92 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 19:14:02.3067 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BqRCQtjYr3cNJ4xQJKvTwcV57aeQtQAWbc9sujK044fOEO7KFykAmtQXKm5AWkeUx7I3wpCnMsmpz5muuxjaDqcJy0s6jpCB0TXsA2hCc2I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4492 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The ocelot_reset() function utilizes regmap_field_write() but wasn't checking return values. While this won't cause issues for the current MMIO regmaps, it could be an issue for externally controlled interfaces. Add checks for these return values. Signed-off-by: Colin Foster --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 79b7af36b4f4..415b7f4c7277 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -211,8 +211,13 @@ static int ocelot_reset(struct ocelot *ocelot) int err; u32 val; - regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1); - regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1); + if (err) + return err; + + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); + if (err) + return err; /* MEM_INIT is a self-clearing bit. Wait for it to be cleared (should be * 100us) before enabling the switch core. @@ -222,10 +227,13 @@ static int ocelot_reset(struct ocelot *ocelot) if (IS_ERR_VALUE(err)) return err; - regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); - regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); + if (err) + return err; - return 0; + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); + + return err; } /* Watermark encode