From patchwork Wed Jun 2 12:12:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 453070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8F0FC47083 for ; Wed, 2 Jun 2021 12:13:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF0C6613AD for ; Wed, 2 Jun 2021 12:13:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbhFBMOx (ORCPT ); Wed, 2 Jun 2021 08:14:53 -0400 Received: from mail-am6eur05on2088.outbound.protection.outlook.com ([40.107.22.88]:57740 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229764AbhFBMOv (ORCPT ); Wed, 2 Jun 2021 08:14:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VOgF5io36U9SCpvx3RnJMov3Z7tah+CelUM9RU8/Lu0ghLjXSY/dNCNAHFW5Gm/aRTkbw/7S14ogAINu5uSs1R5YG4CrtEA8XzBfIlhFiEV/mLMrzuTVcAeQuMGQ9xriQZbrmv6fHCBBmdc2u04bn+Upq0bO3VMkqundy+y55JH8n5NJ4dHYNEUEzctwN1dwjf3f3dNSw5tNBl9Gn11DnGIfy7WJwt5VmZ925nssTtAuiGS+a1TypKBUtY1vVqWcY0tZNfX5zfqXONMzUJjd+QuOKDYfhFqMlfPH9O74rjRzxRDixIVio9zI6XfOC+Hlo98RhUTA5YlAQKAqnDWZOg== 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-SenderADCheck; bh=CGw0fXAZ+3X6PoOdj6a8INxZnDpB/LGVm6hFlXZWnkE=; b=GZ/WHWYt4tvM8uT6+aeyzM4XcF8t9/s0FaFTXzqwHmk9Px622poWl5qK8mzbdbsxVkFDNz/NM0S5xWyk+wac28+rjXnqsS9DtlA2de7lL1xnIchADEQPnIF4HHcX9YQ+8kN2utZq1u9qdboCJtbSFH+5v9W5z1dPF7cZnGCks3af0ks0cNq4BPeW0/LJFkxkjMe6MS2Bt6WJkgTKnD2fcvJCexu29gj22qrQ8aAvGOTMf8KCrfkVPSNhUSJAgcy7IO2Yd1Fv5+VPK0XfR6jfx58Tv5BublwSNfBpM0OTK/w1NLJhwZgUKI3TBsBaO9A9nn0TiEeSuF2Qo2lCpcm3NQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CGw0fXAZ+3X6PoOdj6a8INxZnDpB/LGVm6hFlXZWnkE=; b=heNnvOQhrmQyHuFDlbuw96y6Wh4SXKTeLgcDja+j01YeZE2NZVUoHPUasngS+uJ2+0P4U/EzRvwqTR7iFFtIbPFR1BbatEe4DYDOSSJjLAUPVAo+6m4yAI9i49JJfOjv52z6YEBWPwxzkr1bjYkuUVf3s8gB21jS/ZpdTbj1HgE= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB6PR04MB3208.eurprd04.prod.outlook.com (2603:10a6:6:3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.24; Wed, 2 Jun 2021 12:13:05 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::3400:b139:f681:c8cf]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::3400:b139:f681:c8cf%9]) with mapi id 15.20.4173.030; Wed, 2 Jun 2021 12:13:05 +0000 From: Joakim Zhang To: davem@davemloft.net, kuba@kernel.org, peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com Subject: [PATCH net 1/3] net: stmmac: disable clocks in stmmac_remove_config_dt() Date: Wed, 2 Jun 2021 20:12:36 +0800 Message-Id: <20210602121238.12693-2-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210602121238.12693-1-qiangqing.zhang@nxp.com> References: <20210602121238.12693-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0119.apcprd02.prod.outlook.com (2603:1096:4:92::35) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR02CA0119.apcprd02.prod.outlook.com (2603:1096:4:92::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20 via Frontend Transport; Wed, 2 Jun 2021 12:13:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b04a8d58-c3f1-4615-8284-08d925bfc683 X-MS-TrafficTypeDiagnostic: DB6PR04MB3208: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:81; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /GbP87l+2JxMuPcXPYSs0+rsEz7lF+u7PwX41x7if5pebIxUjzNOSV4QwYyttgfN2jqBFuz1iYWwHDIFPwVzl6lyjGI+7zrU1QsHSMFzEmH9hlgk5t8XJRg0AuNCgmR+pRNmD9ns9b4jxTpIx1viIsvbZojWpFXLfzF4AvkqC7ymVzfPkzSzGW14HisigQmXOZ62USQjyQU2m+zUA0SWj/YzV5Tx7jOpcyRgtoRRzxOcRQK9/fvdWn8ERLj9zLolLVDUewU+QfsdV1M2CmrkoF2DOYz5nRMv2T7R+WRmkCoUlvVcEhFFCfx1jz3/9jMWRe5wJSLDcY6L3xka+CwSftnE6ZUcPyvghWsON/zIl36xifjh3wEc12ULj6+FpkmkvWe3ENOKSPcFZLUReG4JsLNBnx9al7XDZhWZTDyAQzJipcc0AV1id1LqJiA7gWeD4bOCJb3CKm0RXNY1ME6IDBVsFofHnUFWdVrB0ht6ybVBlNBYjtM+O/Ku8vyDoJS1f1AN2l0ZyKNqFlgJkkvb+wRpkY/9lE+Pzr4vk/4xPbj5hnWx/qM3rA0upc5ZbUgajjI0ilJvQXp1T4KspG3CGj2DQGsAxRcDjVmSdZS9wCK1/nq9gOGRRtUmSNNG1MVN4+pQfarvIQusCM4VcyKSUEruLss/5nU9ZwFP1hRHIJadW44akPtBDUfHvdQspsG8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(66556008)(5660300002)(66476007)(4326008)(2616005)(66946007)(16526019)(38350700002)(956004)(8676002)(36756003)(316002)(26005)(1076003)(83380400001)(478600001)(6512007)(6666004)(8936002)(6506007)(186003)(38100700002)(52116002)(2906002)(86362001)(7416002)(6486002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 57m/FUDtYcP8Q54tAlYaZQjBi7wtGKd+yir5JMmph4zjIwy5LNCjUncw65cuYCPW9DC1yjx0kRaMK7OslyBjV3d4Bo2YXdRpAjbQWW7ij3w5HmKMGpZkcmP+6FCRMcdwR2OT12qfaOkj0nuPo47RhYNCMdtLEAD+lLgQYkNvFIT0lemSWkoO0uMMElePk5733BZBhzH4xNoo26G6v5e1r0bvxUpQYA03wWeGGVETT1q3uGLcg0yqPmzvaI+8BJFMEpQhaBmRzK3uLjez0GKGii3BOzpT0Cr2d/hhhzq2grh1FO3rFZsKqW1xvex4z/hw1RO2qXY2SbmycA5Tg3IYpa10kdym4bRTJFf8gRkXJBu0yu9dZJW38jLXG3aZNzemwNebJ6RzVtPxpEYu10OipsB+eEDja8eXdj3Z5ps5zz4EEhiLfFgTIyyFeTKRDcY2ddlSMx0dPQznleRQapM3R3bKPM5b5thNdgvfiYB7uW9Cld3JM7G8jZBjKzLllI+qMmbDjYWMtJJJd9nBFzcP0Uc+LCYWuXoul30r0AXp96YfmIDQXstVpGl8Gl0thX9hlQn8UohMgMkYaX09Jp14pch6WoZidRsAOg2GT97Iq3OmhwK+qsCbqS6LKuKKuw5fyAkyoKOGhBE6YfMPIxHlYXddJIkD0Gl+tmy2yf8W5WCNCwrvOgTvGufzMxBQDnqCIM75aUE1mWC2sUAayq2Nx+4DVYePJ+6IysieTNLjy9qNm0rFJk1hP6aMYvSe48f8b9q1ElAoMNIxD6H0FvopaxmxPs9LgO+Rk0tvzVq19b8GaQJR9+car2ZS5sAmyFDhgdPo2a6kFdmFAiSRJN+EM9uKvHBHKfqtQLU4vK+65AuG8kGY5VaKTWPa7Vt+J3mOfOzPDLd8lpeaGb6aQB8HsiU7QBIPwt49QOITbDEuaN5j/Vkj+/PJ/0jZDsSwQ81vmwoVzCMcwY+GjVweWpzj3Y1wIWQWwu7lvZOyIFzz3V1c4e+4407GvbLQ9K4wDsAQa9V8ShkRJHSrnL8aiwSjlR6y/5SVZWyh8m3Br4NeHWGmn/RB8X7YAOUls4xqj5drP3euQh9nrDstJZjyCFx2dHQz2fLr6VcbCyxJ6FRji2Q9JDbkSHb2Z2s48UOX5BVQhkxwMsfKMtjdQfzdrhnmrOA/y8IVAWdMXL72yLVy+66GFNzGM/TenHLxkXhbGRNobJTAmG0c4nP+QbwpmzIIz93JDJeOVuqyQkJlisGuoEBMBZ9QU7M1K9CXl4Es2MjqRT43VSqm63SKRoTEgo4/bqqI4uPNIZ7RW+hH6ypI/bAVycEOwN/Q2ZK21aj0s6D5 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b04a8d58-c3f1-4615-8284-08d925bfc683 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2021 12:13:05.2230 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: O3lkgV5zsb3ImiOEtE1XFNz/FZx4xlAanhBuFlfdZJh4J5r0WcAXOALrKPhz2geBNVSqY2ZECxyIqv+iMNNS9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3208 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Platform drivers may call stmmac_probe_config_dt() to parse dt, could call stmmac_remove_config_dt() in error handing after dt parsed, so need disable clocks in stmmac_remove_config_dt(). Go through all platforms drivers which use stmmac_probe_config_dt(), none of them disable clocks manually, so it's safe to disable them in stmmac_remove_config_dt(). Fixes: commit d2ed0a7755fe ("net: ethernet: stmmac: fix of-node and fixed-link-phydev leaks") Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 1e17a23d9118..a696ada013eb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -622,6 +622,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) void stmmac_remove_config_dt(struct platform_device *pdev, struct plat_stmmacenet_data *plat) { + clk_disable_unprepare(plat->stmmac_clk); + clk_disable_unprepare(plat->pclk); of_node_put(plat->phy_node); of_node_put(plat->mdio_node); } From patchwork Wed Jun 2 12:12:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 453931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85AC4C4708F for ; Wed, 2 Jun 2021 12:13:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69F42613B4 for ; Wed, 2 Jun 2021 12:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbhFBMO7 (ORCPT ); Wed, 2 Jun 2021 08:14:59 -0400 Received: from mail-eopbgr150052.outbound.protection.outlook.com ([40.107.15.52]:28734 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229823AbhFBMOz (ORCPT ); Wed, 2 Jun 2021 08:14:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MyfZClarUthzildFAnubyiW2afZfd4IHrZNwxQfpJwpX4hhoE8zzzeGmau5IBZ+s3EH5N8seyHc7wtIql0hBGB95e8N2BOMMBWnmClBw15M3DZeFZ2yUhd/ltfCOwf9rF57bQ503CgSyf428sBt55JaIzXESoqGSo7zvPhyzaZw/lEg2WvqEiAMVMubPm7w66maHaH/Wxkfz7JgY/RC85JO9HMacSI5IodlI/QiHi2ycZBSkm0Bf0nPGMZPDJ5eNs8YmTTe0AiIWqkk8GOvOnw72SmJvwX/DHn1szUBBBVEJu0/3NfLRy0y6/GddUfnzeeXILZdCnkcKQI7/D5xC9w== 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-SenderADCheck; bh=T+Ru75bR9z+ApdazjQlZA/llUMNktPizvHr7DfmOY0I=; b=cQn3nGldCrCs5WPCG0MFqnp/N4QqezfGvRKBUOVjg3FNmle2ME2/u0q0CefTWuxXR7vhaiYl57GJojIUTc/TzXhHX9Z9/PrLFg+QSu28M8PJFyZaGQy4vJeI0jNZ2sKwUFOyY47iGxFFBRaGq6/ATKQn43CRSqgLUKuYjlsgifyP7nqtIe3okuLi7iNPmqLCaHzFst3Ey9gl86J6cNTD6cRDBDxMrpkVKYpj0R3CGLZDAc+dFE/7ksfXZGqcJfxrmkSIGj5KoNbMn0shBiEQt3m2Q5GL7M87yZchYm/7YEVh9gMLOiyE3z6zw7Itcuk17Pcn/4bhC5BVOaVDnetZAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T+Ru75bR9z+ApdazjQlZA/llUMNktPizvHr7DfmOY0I=; b=FXWLp82p2jssknErZhqpiAGcnk3IOAU2sK0mb9H3DiIiSgzaecS3VromDNqJfiU/xAOt3YsTHVybMcPcbiZMV5ge2n/v+LAtI98IWeMFYT0O8pXzegVOIAysPt01KsegI5jIPxO38R2mvFnvaE8ZDmmcdDY+1qrIxnFQkrBFUtc= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB6PR04MB3208.eurprd04.prod.outlook.com (2603:10a6:6:3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.24; Wed, 2 Jun 2021 12:13:09 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::3400:b139:f681:c8cf]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::3400:b139:f681:c8cf%9]) with mapi id 15.20.4173.030; Wed, 2 Jun 2021 12:13:09 +0000 From: Joakim Zhang To: davem@davemloft.net, kuba@kernel.org, peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com Subject: [PATCH net 2/3] net: stmmac: avoid kernel panic in tc_setup_taprio() Date: Wed, 2 Jun 2021 20:12:37 +0800 Message-Id: <20210602121238.12693-3-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210602121238.12693-1-qiangqing.zhang@nxp.com> References: <20210602121238.12693-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0119.apcprd02.prod.outlook.com (2603:1096:4:92::35) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR02CA0119.apcprd02.prod.outlook.com (2603:1096:4:92::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20 via Frontend Transport; Wed, 2 Jun 2021 12:13:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5de2588-ba01-4c08-1304-08d925bfc8ce X-MS-TrafficTypeDiagnostic: DB6PR04MB3208: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TC7K5TI8hoJ/r5LHGLbLYz2Pgov5M/N5BYrwypzUQbj5Q9Shuk7ICQp0DwAyUOUGGuJUCK2FnsCQuSChaBso9o7Z76Tn2h6sfJp9Id+tp0YapYa+otgVCSaqo95GZD2uVwDqcHA/urndzjHh3uEnhiIoTCYu/uXOVK3ZNI8K21u1u2CQaBonfa+xt/vn2JPA0f/bzsWNAmQtPRy5AVtAao5dt9CYfIVLwjlHunWi7qC7VBxp6tVrB9CoeARhG9uSE0Taf0Qvj3dJD3tQbQHTEN7yUTFW2zI8E/PgHLj/ngzeJfvFWhoXKxzgOb4UGVHGvNpsgUsHTVPwqt33x/8BhVsPH07RJj0Cr65XFqkgbzH6RGrRPEdRkqz5k2V5jtlUHHIjEiTO+oBzSIW1pPNBbbTDHmnyMNchMgcSEROOUCn1f9XMzWX78Ccas1UCIjuX7lmQln+LzvUEaeqwZwwdqPNWOXlK+RvEYerjg/iLkebGNvOwx8izXKcz9xRbuOw/qAPC/iOfFgaAO2BFFB19Q/DITKEZ/hYg0h7zvCK2K14vA2sKnqkVIjHoSNHgp95CWjl3Bx4w2LFkh6UTkWuwCNwu7SoB7GOuowp+QJHvTKHkXwS7R6deMVUAWKrSB52ndYDVMY90nU+9wHV5JZX6oahFCJB1QUbb+WOPNWP3aN1PT9DzMZLFw1/E9WJwquqc X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(66556008)(5660300002)(66476007)(4326008)(2616005)(66946007)(16526019)(38350700002)(956004)(8676002)(36756003)(316002)(26005)(1076003)(83380400001)(478600001)(6512007)(6666004)(8936002)(6506007)(186003)(45080400002)(38100700002)(52116002)(2906002)(86362001)(7416002)(6486002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TRUv49Wf+0qXBEJqEe4yYb1NhK5Cls1MLyU9Xz/QPnaPwWARncO4DpaZGTYQeg/s4MqPXbdNVb1XZUmgB8S4N0OpSatdf0H/vEuwYQNaaxnuM+2O2H7xkhGnPWzYJDadHbrWoehzj1QdtVU6XdJP0aSEcSPUtFvqmne4RDsF4E8pizmoAbshJQ1nBMIcRgtbXTpJSUdhccQRA9m0coa76aSHasvs5YxAaG0/ryRAknG+KnRT7euE+7RAh7jSoJQTUYfc+ReQbqrId4CNO2dXEmQbDC/LVKhz5W6+Mu7+WMjZnGYURglry4YsBkoRbZwjaNezEHEvjz3kD1RVjIQSi7WimmY1y2X3dZLs6H0i3NT4WPAn0GSI5SL6CTwWZ0ttsLCBWudMG0gnPbfL7dmDR9K/woYYANOXji/47LiBhP7u83e+Lk9tojGdk/LTy7D7EZKqDPNgbvh89ESMJcHuc3sxEsXft+fvxmYUDPNlj6pyQk6UeL8ZMPiCnNjfg4iPcjHHn7RLZ5rm1A6hk5yxMmP4cur5aURY+sR739nMgxjSFG6rHq6fhF17qFfLmpa+/BJ6+xlc8nNFjy+QDim5DQL3I0wE7kDSUVYKJjgZ7I9iPhes9H0KmGsYYoG0hNNWqZX+zQ5uWoBcvlnHx9/6UfCYuW7C5yxylfJAnpeyjKJ8L8O14HYNB+D/wMI/p+Tr5SlG4zvc2cAy9LDWz0ZWK6mKZu5bUt6WRX5HJ/jI6mo6E+l4j8MRA7jrjOD3YpOiKnt7YMFK8WuQRs580bsPC80WNtpHPkbK0cf4rRSp+0svN5Vud3dOIhWxEvpQPBOG2rIUQwxXAKEO1zZW1R+ZLFqZBwuqIVMT0aQArB/R5KH7m9thDItw4TmbH3odAz3wF0Alp+j7nWPXXHeb7UgwCbd8PfFj4qnXNJLc988tN0m+pX1DM8WfJpc6x+FbUIcIuLoKyywXy4WEQX4xrU4MaeBs+9h/Zpyx1uwzXFQR6VnJHDPoFlBS+kc+W082bAKXOz2b/BIAGRqt+k7DJ1SZw5rWksk8+YF7PrAM6dJK71s2g5rwqTW7vDFvrTNMtniEwCdVHQ6I8zWFTtqiTw1Sl0JxVl0xnnoEpOIrChjx7/ErQSc770BHi3CDPOq0Ucdx6H8eB8iuStTqGAfF23lLn5kBhAnw6pOU8W8obptTfb99ivaA3ScGJmiepE1Oam9wQIl2VzyxjgpAVutKu2DkwpPkPB6dAeju+dMi6i+fzvIAVugoRzGrsuAj7aJmAn8DxUNszCtnmyoAnnz0X+ip44O6EbqukJf/F2HZCU+fWNENgh/lLEsd6Q9u95AOoYcx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5de2588-ba01-4c08-1304-08d925bfc8ce X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2021 12:13:09.0781 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zkg1MrYXVws7YzwpEYQAFLR8GsgSDvfdDVBLxfpYcnpCNbINKh/Lz2ykVjhhtSbXtsOWRiVH5mZ4ETE+TSt9FA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3208 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use linux tc command to setup the taprio with hardware offload enabled, in some circumstances when taprio parameter error causing the taprio_init failure in qdisc_create(), then cause taprio_destroy() which call tc_setup_taprio() in the stmmac_tc.c and panic on the un-allocated est structure as below. [ 15.417444] 003: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 15.417455] 003: Mem abort info: [ 15.417457] 003: ESR = 0x96000044 [ 15.417460] 003: EC = 0x25: DABT (current EL), IL = 32 bits [ 15.417464] 003: SET = 0, FnV = 0 [ 15.417467] 003: EA = 0, S1PTW = 0 [ 15.417469] 003: Data abort info: [ 15.417471] 003: ISV = 0, ISS = 0x00000044 [ 15.417474] 003: CM = 0, WnR = 1 [ 15.417487] 003: Internal [ 15.417476] 003: user pgtable: 4k pages, 48-bit VAs, pgdp=00000001b71c4000 error: Oops: 96000044 [#1] PREEMPT SMP [ 15.417482] 003: [0000000000000000] pgd=0000000000000000 [ 15.417487] 003: Internal error: Oops: 96000044 [#1] PREEMPT SMP [ 15.417492] 003: Modules linked in: [ 15.417494] 003: CPU: 3 PID: 836 Comm: tc Not tainted 5.4.24-rt15-00033-gdb22403-dirty #3 [ 15.417499] 003: Hardware name: NXP i.MX8MPlus EVK board (DT) [ 15.417501] 003: pstate: 80000005 (Nzcv daif -PAN -UAO) [ 15.417504] 003: pc : tc_setup_taprio+0x1b8/0x390 [ 15.417514] 003: lr : stmmac_setup_tc+0xa0/0x3b4 [ 15.417519] 003: sp : ffff8000126c3760 [ 15.417521] 003: x29: ffff8000126c3760 x28: ffff000177712400 [ 15.417526] 003: x27: ffff000176e4b000 x26: ffff8000126c392c [ 15.417530] 003: x25: 00000000ffffffff x24: ffff800011f903b0 [ 15.417534] 003: x23: ffff8000126c3a80 x22: 0000000000000018 [ 15.417537] 003: x21: ffff000177040080 x20: 0000000000000000 [ 15.417541] 003: x19: ffff000177044840 x18: 0000000000000000 [ 15.417544] 003: x17: 0000000000000000 x16: 0000000000000000 [ 15.417547] 003: x15: 0000000000000000 x14: 000186a000040008 [ 15.417551] 003: x13: ffff8000114db3d8 x12: 0000000000000020 [ 15.417554] 003: x11: 0000000000000030 x10: 0000000000000000 [ 15.417558] 003: x9 : 0000000000000000 x8 : ffff00017088ee00 [ 15.417563] 003: x7 : 0000000000000000 x6 : 000000000000003f [ 15.417566] 003: x5 : 0000000000000040 x4 : 0000000000000000 [ 15.417570] 003: x3 : ffff800010b94d74 x2 : 0000000000000001 [ 15.417573] 003: x1 : 0000000000000000 x0 : 0000000000000000 [ 15.417576] 003: Call trace: [ 15.417578] 003: tc_setup_taprio+0x1b8/0x390 [ 15.417581] 003: stmmac_setup_tc+0xa0/0x3b4 [ 15.417585] 003: taprio_disable_offload.isra.30+0x78/0xe8 [ 15.417590] 003: taprio_destroy+0x80/0x11c [ 15.417592] 003: qdisc_create+0x408/0x4c8 [ 15.417597] 003: tc_modify_qdisc+0x1e0/0x688 [ 15.417600] 003: rtnetlink_rcv_msg+0x120/0x330 [ 15.417603] 003: netlink_rcv_skb+0xec/0x12c [ 15.417607] 003: rtnetlink_rcv+0x28/0x34 [ 15.417609] 003: netlink_unicast+0x18c/0x21c [ 15.417612] 003: netlink_sendmsg+0x27c/0x360 [ 15.417616] 003: ____sys_sendmsg+0x284/0x2b4 [ 15.417620] 003: ___sys_sendmsg+0x90/0xd0 [ 15.417623] 003: __sys_sendmsg+0x78/0xd0 [ 15.417626] 003: __arm64_sys_sendmsg+0x2c/0x38 [ 15.417629] 003: el0_svc_common.constprop.2+0xd8/0x178 [ 15.417633] 003: el0_svc_handler+0x34/0x9c [ 15.417635] 003: el0_svc+0x8/0xc Fixes: b60189e0392f ("net: stmmac: Integrate EST with TAPRIO scheduler API") Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 4e70efc45458..dbd1320c2597 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -862,9 +862,11 @@ static int tc_setup_taprio(struct stmmac_priv *priv, return 0; disable: - priv->plat->est->enable = false; - stmmac_est_configure(priv, priv->ioaddr, priv->plat->est, - priv->plat->clk_ptp_rate); + if (priv->plat->est) { + priv->plat->est->enable = false; + stmmac_est_configure(priv, priv->ioaddr, priv->plat->est, + priv->plat->clk_ptp_rate); + } priv->plat->fpe_cfg->enable = false; stmmac_fpe_configure(priv, priv->ioaddr, From patchwork Wed Jun 2 12:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 453069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B00C47092 for ; Wed, 2 Jun 2021 12:13:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEA06613B1 for ; Wed, 2 Jun 2021 12:13:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbhFBMPB (ORCPT ); Wed, 2 Jun 2021 08:15:01 -0400 Received: from mail-eopbgr150052.outbound.protection.outlook.com ([40.107.15.52]:28734 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229812AbhFBMO7 (ORCPT ); Wed, 2 Jun 2021 08:14:59 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lSGaPOtv2prNqIcsEBFEYO25iu137zz6u7PndpDeO3GJ66YtpSqWPMM5jjgspisYyrR6Kr7e5cwBq5Nkxv3J7v6DVFSylAJUpFOJMpqa230FMc1VDiQhk4jw3LYReWJ86qhlrmPcpXDIq7JEkUgQ0a13g9Hpywqtv02CS0tSZf/B+VxTXVdKNQiFRNDnJ06lOgKguLH5vGJChg4sAF0ZP15VxQ/HQCWEgUn5IVI/H4ac+7he6u0Q+g0+OHR0HRS9nuS1+mj+WjqExfeNjHYX6oDqneR/LOhoJEVrKf34z4kT16m3NcDtYEixB2QOdjBWR2OZueL5Y6u3zsxuuO7c8A== 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-SenderADCheck; bh=GUl1y4Jg7eMgXIC0FjWdnqzMrqLRLNIwrz3uZb/tj9o=; b=gcnRPiZmdlYBTOcBkgZ1428jxzKBhyzDEeVHSSzbSq8xLuX8pbWxaTXWVeH/yTQLXgpkOYWldmpQ5XF2tFiR5n90qtVwHZMtupggyElLYSP6BFleGmg29ZJMFgfLrrjqfNIXE1OpWQ0fjYLG3y4R9PG2krA8F0w8VgzXs/qb9IZOv4JKshSw4YmIdZRRGFkW/OxQuWpaNCRRg1OyoX0WwkT2LghjlPLyv+2BwJlswpCeb7zZXet5SfZn5rP/13xmCJSlbbh7BfeaQuujdin2Bk1a8iIREbiQ3AmxXmoRmoP2jSJRy2Qy7bkXi8vPyciLSi/iV6j3zWf00okMgS5GuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GUl1y4Jg7eMgXIC0FjWdnqzMrqLRLNIwrz3uZb/tj9o=; b=qdhZ9v++cDGg5bhKVi0hJfU4FzgCSqJ4QslNwSswV3vEdSnpCPADLazEjkvKCZIUJZ5bFaGPJobkxSwRYpNwYS3iJELcbm7WCdbbtB5LWRkNzJw4ek7dSDIPZndksffvOvD/Gxy0AGnxWQuRPqkt2hms3/4i3XFD/7L7RMIoNgI= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB6PR04MB3208.eurprd04.prod.outlook.com (2603:10a6:6:3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.24; Wed, 2 Jun 2021 12:13:12 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::3400:b139:f681:c8cf]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::3400:b139:f681:c8cf%9]) with mapi id 15.20.4173.030; Wed, 2 Jun 2021 12:13:12 +0000 From: Joakim Zhang To: davem@davemloft.net, kuba@kernel.org, peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com Subject: [PATCH net 3/3] net: fec_ptp: add clock rate zero check Date: Wed, 2 Jun 2021 20:12:38 +0800 Message-Id: <20210602121238.12693-4-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210602121238.12693-1-qiangqing.zhang@nxp.com> References: <20210602121238.12693-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0119.apcprd02.prod.outlook.com (2603:1096:4:92::35) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR02CA0119.apcprd02.prod.outlook.com (2603:1096:4:92::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20 via Frontend Transport; Wed, 2 Jun 2021 12:13:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b3cde4c-b2d9-4c2b-3bb1-08d925bfcb14 X-MS-TrafficTypeDiagnostic: DB6PR04MB3208: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:88; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rnwjSHmIVkmJtyJD5lnX6HDjYSgN9q3FnS05Ce0iXGyB7BiJ6eNyxBBkqY2M1XCnJzqAV++yPOVaxFrlQnQ7lhwgypaJgR0nLtdtKIuCr73PU7f30pfbTSEcOx7KWqOvLU6iy8+hEcxeTFKMDZ/OHGuIKV8p/pbIoldfdqb4r3XaFMtGnIfHsJpJQA2rDokZ7cF+SYkqVxs8CBI55jyx+nT8OrO1sjPXRztfuuwFkiErCcMQix3sM42I3ys/tmli3hcAIH0tFeYvzDglx9PSSJwJfl+FGuFDT4hFihpxvlJ5RonBBF0pPacoHQeXOkGQ2KiUrc1MwJt1DvEHN9jdMk9JYe093FaLuEMlOSyQdtfnw7Y9h/q2hPkARO5SXx0StfaGxxaVLv/Ix7d6AxEnGwNzjwnzxa6YaA1NbBJtEQIT51riwfw3N7Wq8NxCce63WZnz/U5y2gD4Je31GfGbRS4gyGm3k8WvIxR8CsCLzUonOWus0DUMFsIjiVN/AOz3qMQgommzYdP5zI+mK313WLtJujXHF7krKXpxVJyPBeBC0pmQSSoxDU2ALFWDjNIz2YehFwuX7DsreuaCpArHZLA3l074+nPGfqMobfM6tcmb8oGo+VvvLd7s3QyXNvVtw6G9EfKG3tsKFMgVPdDRGQdLi2p0bPZxx//ahBJFRrqfLnmtkRIXxv5q5ry2g7Zs X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(66556008)(5660300002)(66476007)(4744005)(4326008)(2616005)(66946007)(16526019)(38350700002)(956004)(8676002)(36756003)(316002)(26005)(1076003)(83380400001)(478600001)(6512007)(6666004)(8936002)(6506007)(186003)(38100700002)(52116002)(2906002)(86362001)(7416002)(6486002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: E/Kq5vGOM+HG7l8qQVrghtLoRPnpUDBpNXqK+NGpj6ByB2LyumTtAe8IIo0QdoljXWotroQJcdYibxNq3pui9E2wlc8uWRYqDm/jKTKuzy97vpZUqn4ztU01qbgFlUbXbKPDXpmwXoSxRqtQiNBHOBZ3sEqmzI6awmH8GAST+9amkIQryfEtBsrb83ohX+tfBMsMmlNySQqwGDOol2Sd4PU2Nsk7OVhYQ5sSd3J5/c5IjL8WNDl/Zl5SFYFU7BAc3kDromoFj9eeyinbd2qyYyUEt7/oL/C+GsfjPm81/2uuleVKPmVjw9hTh1NRVKUyZUvbWRTq2Tz9qetCG0ks3x2lszmtfjCsQVaIoGk4+LRPdKlCaz+HbKrQpQVgg5qQbDm4aPmYMFxttOqC8FRJaueqbfnahQVgvIzSTzuQVMRRYXSA9zI2tDXnPB9BonCm3MV9KBRkS5f1vjPNacp+K2IGLnrs7zWgBdjfYWPI+p+rRLAbxIel2ge7pVFssr38j+xO25aM/fZSgA8nDvzqw0g4oL2eDeQXgS57hLTlCeUO4xmFdaaJwIpRI0hlPKhQTYZyCCRIPcJD7zT6Yu6HJHPGS3YbJPZdSLf/V6jXzFIXfEhovHZqaaZGnTxSmndzcT2JhZmj48kJna1v1LDrlYlAve8ZFAgoE5/wGa41gev//wVSwAZRkIl1F0HSMfyQ0uVIAvuAXz/rSieC8Pl3AcYgUpKXmHx3eP3W9pVj/FeOSjiKfnTbIT81Ctfn6h8kVXB9pQj0NjHdNOnA6YnK4Ua48jAd9WU+LQ1haKnVi+bay0MrEgNFTqVgMCfgKb7PoMH0eJTxLSEWsWA6Tx5PPXPFHiwogfT4dk4NizQCkN6mwAtbeNuWX6c+RNsp7Cvl23XoKXzgTjwlnGwRW/RNxlLy7Y3C+ZxqID9GAvuLXmkM1Cd9j1TB8rZg09IhBmJ2Gi8H9UVmaXtyJk3zvJwbdckJgGpJ0Imp8c/CM1iYkgvrMKmTFf0bCi29zqW07qBEEA51hboexaL4gUYn3gKynFAKuzK+5atpZ0mA6Ch+0uqezfMYGEpy0CH3dorvV9yNhpYuCowIozLwiLogNYC/HJUhqZQ9Sfka7yp+7MzNYLpmm/r4b3I3rvI2soPR+SDvCk2oy036F9+wxdYhJKG5U2mlr8pidiaZB66fasNTw75DRwYeTFdawiJy2bVsZGvxreUUNISnsH0N0I2UeEV4UOsaXMAhBcU80OWrC7SiXBcfzMR/mFCiaAKayYeaVjP816JBRNA8WzDqd1xt9D96yvTTzIQV6JWKqY5uDBM46uUaEEkYKBf1FP9VjqTNknAB X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b3cde4c-b2d9-4c2b-3bb1-08d925bfcb14 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2021 12:13:12.8555 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CftFBac7qEo5u2uRxmA4s40KW4dQIcdYajJUpfUpOqI8rbxug99J3jeSqlVcDLXTNVnv2e/Z9h69itzDb8GZzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3208 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fugang Duan Add clock rate zero check to fix coverity issue of "divide by 0". Fixes: commit 85bd1798b24a ("net: fec: fix spin_lock dead lock") Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/freescale/fec_ptp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 1753807cbf97..7326a0612823 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -604,6 +604,10 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx) fep->ptp_caps.enable = fec_ptp_enable; fep->cycle_speed = clk_get_rate(fep->clk_ptp); + if (!fep->cycle_speed) { + fep->cycle_speed = NSEC_PER_SEC; + dev_err(&fep->pdev->dev, "clk_ptp clock rate is zero\n"); + } fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed; spin_lock_init(&fep->tmreg_lock);