From patchwork Wed Feb 9 08:39:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5pOO?= X-Patchwork-Id: 12739801 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 44282C433F5 for ; Wed, 9 Feb 2022 08:41:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242349AbiBIIkr (ORCPT ); Wed, 9 Feb 2022 03:40:47 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:52174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242343AbiBIIko (ORCPT ); Wed, 9 Feb 2022 03:40:44 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on20716.outbound.protection.outlook.com [IPv6:2a01:111:f400:feae::716]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14CB2C004386; Wed, 9 Feb 2022 00:40:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UyBu60HaEAvMMTIkW26gAvT7TRVNyew1VVXXRarEdhtxBWN0CQCLzMnAlScF88OdgGXpP+NHdidoVw54nFVpZ3M0TE4hCluiuwTi2q/XMDfWRXCcT+GQLfZ94okVCuqN4CWxFpT0gobVhChUFLJTBSlTZNX3pdJcu/3eCcWtsjt2bT8LWO5v5czlsDJMjRIxUIscaWbQmUqpAfsDUd6MoMGPbRaSV6vHr3dFX9efpUKzXhQU2EMXFJLuqO+/suapep9HETKLVPSxS64uwPDNmP6l5Ad4oCcnCFi8vLTwV/Kiu8bPO8RcNVopvhJ1Aw/CYLCmg7CHjmHCogDmAcEiXA== 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=GxsPlDhgobC6O+ovZ2hYF3olKIKu+FV/9XDiePKQvwI=; b=L2UkVSKXxPHKu/uIk9Q3crCEjghACWuIUGi5+7KyBm5bmRdABVooa1SzWtWtCXS4G5DiqjL+OPAezHPSnqZkGD8V7Dd+TJJ2k20sbDbRRjMRf6vFHDr8xZ+Ysmt4gZgHZG3T9LZpFJUBfiuE2YiAjiaMlG5vfBGFd3K0E+Bp4yt3MB6bvLgs0Mcd7JohsYYk5YKdy1Uaw2jjg6kow4FnDDjCoe0vIXFHq5bYSRouoexk+YCp0rc4nJcMRuRlDRrGu8I8IX0E0xPh7sGW5CxdyiWic8395uZE5a8F6XE+pQ5MOhKGYoyoOS2LQ5CzYcjVgTsT+rAN3+LgGkZ23Lrgpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo0.onmicrosoft.com; s=selector2-vivo0-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GxsPlDhgobC6O+ovZ2hYF3olKIKu+FV/9XDiePKQvwI=; b=Mbo2yQiwjRsaI6lUViqviIQMzL56dUNxNL/Skn4vIMUrpslsJIryDkN0/tSHklJ2XOaTJmie8x7phQXQvcxf9VyCNeRsLDvOeWjjw3898I14p0ahNKaVsSaXGbmm7JqJhQfAU61NFLYDvfnwOVyor4DK5BMvCDEXc4N9460eBwQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SL2PR06MB3082.apcprd06.prod.outlook.com (2603:1096:100:37::17) by KL1PR0601MB4387.apcprd06.prod.outlook.com (2603:1096:820:7a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.14; Wed, 9 Feb 2022 08:39:27 +0000 Received: from SL2PR06MB3082.apcprd06.prod.outlook.com ([fe80::80b4:e787:47a9:41bb]) by SL2PR06MB3082.apcprd06.prod.outlook.com ([fe80::80b4:e787:47a9:41bb%4]) with mapi id 15.20.4975.011; Wed, 9 Feb 2022 08:39:27 +0000 From: Qing Wang To: Derek Chickles , Satanand Burla , Felix Manlunas , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wang Qing Subject: [PATCH] net: ethernet: cavium: use div64_u64() instead of do_div() Date: Wed, 9 Feb 2022 00:39:19 -0800 Message-Id: <1644395960-4232-1-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 X-ClientProxiedBy: HKAPR04CA0016.apcprd04.prod.outlook.com (2603:1096:203:d0::26) To SL2PR06MB3082.apcprd06.prod.outlook.com (2603:1096:100:37::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f9b2cfe-1903-46d4-2055-08d9eba7ae6f X-MS-TrafficTypeDiagnostic: KL1PR0601MB4387:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7oEBNKBplJ+n4J4hWxD74+/9/Pcbhi3WZsfr0U3QhrhJzUVYL2kluiY9MWDd9LbkYXq7myKY1838evQG0pVX0OXLiv+k1fKaEgNVqlJzBVvKOMGwJS4239hsQm23h0pdyXGkL02IyRbYiEWAd86lkwSUlVveQOXZtfmYDiyf97DwBhUYtciDdq4D3tmC52vqSVaMQliT03JmkFTCoYVVqB5W9wjpTuUSPNQn1ILFTvxFXIYgPaxCTbdDEe9fSu60V6rkz1ebmlamEIVuHeAdGUnMV6egs7yYgAYgK50NhpMZKv1ubDhWHhO4oHsdE+cE/WAu7F1G3M5vIeCl0v+dALnHObfOqbSM7YlDz6p9ZryW+6qYGArpkaJ1HNMpWirufPQRaQApnyCi9DGWGEjyw3Gh6AEHPmnbzL2zLSGgqhFMJ+Bd3tjP8vlxHe+UGSJz5Pa+HXQSzFKDr0RbzdVblB5okn/B+g4fCpKGNqBMZYLbKewrfCVv8/ka6+b7Ox27+Vlcsp3j1uYayZ5ipONh8/1FcZlWJ6yfrfkW0zrmPwiwVNRuQ6rTH4nA37nFavkFa7HGR0bK6H6kqNh2WJVXQAEUILSHRGvIHia0azJDh3KDOI/mCC61zFex6MEqIYBY4207oy3+SCAkqIJEjqQkhMcHrLXTh4j4PBHyu7wbXY4yC9cJCBPaPWqjQybQvoFZNIub0RiUKZ4CCHt3xdbxmw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SL2PR06MB3082.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(316002)(4326008)(110136005)(6486002)(66946007)(66476007)(66556008)(8676002)(86362001)(38100700002)(38350700002)(8936002)(2616005)(2906002)(107886003)(36756003)(6506007)(52116002)(5660300002)(6512007)(83380400001)(26005)(508600001)(186003)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wMVh4JQwstgbnv35ltCKyXd26BkU1waqT90WVovJJM8TfUHcsW7pHLRZsggVcsSfKcxQ65cJeCrxNgL9Qng48ZFJIKhboflysZQZicAiQ+bK46UnLBYulFQ+d9hXTpiTiuFjE4Kai08RLizcPn5J/HHDohTzYbx7o2sO3bR467mJmuiBuawu9egvns5seqRyAGsM/gZZSz/eD96bG13531Yx+eNoTSv26WAJV8TCPHOuFpDR26pDbkAer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457DoFOJbagvkZpIwLXbCiGd16s7mht3eCcyAkxuQVsEu0UI3bB1rq+XYHocLfnQedFyrYwAh4g5GODkjONUmZpxPKbQfARqAH1jYKYen4kzaBbsnP894owQ7NodwKBSz46Kl72ckg0rCM3N0NM5Mc0OVKQgkn4A4T48iZMIlfEHcrHdFLVKO9R/8WqGYilk8e96OGbQE+7mlC/67/22YF4iaT1UJIktpAGoQBNukTS18dsiRp+zwLhJ9GxzIRqYZ/MiTgLR5trYAigmgvZcHLhpAMPwdbzHJ0tT+MSUEtqaip5kLPdBzGXLIpSGy5fHMeHnYLCw= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f9b2cfe-1903-46d4-2055-08d9eba7ae6f X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3082.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2022 08:39:26.9626 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CbjLUz/seISY4qlEl0ThQIvluqks7pLRfUIs1G/I5T4ixm1LF7FV2+2ZBkAgC9zvfoSI1S1wB4x9mPcZtwHyvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB4387 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Wang Qing do_div() does a 64-by-32 division. When the divisor is u64, do_div() truncates it to 32 bits, this means it can test non-zero and be truncated to zero for division. fix do_div.cocci warning: do_div() does a 64-by-32 division, please consider using div64_u64 instead. Signed-off-by: Wang Qing --- drivers/net/ethernet/cavium/liquidio/lio_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index ba28aa4..8e07192 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -1539,7 +1539,7 @@ static int liquidio_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) * compute the delta in terms of coprocessor clocks. */ delta = (u64)ppb << 32; - do_div(delta, oct->coproc_clock_rate); + div64_u64(delta, oct->coproc_clock_rate); spin_lock_irqsave(&lio->ptp_lock, flags); comp = lio_pci_readq(oct, CN6XXX_MIO_PTP_CLOCK_COMP); @@ -1672,7 +1672,7 @@ static void liquidio_ptp_init(struct octeon_device *oct) u64 clock_comp, cfg; clock_comp = (u64)NSEC_PER_SEC << 32; - do_div(clock_comp, oct->coproc_clock_rate); + div64_u64(clock_comp, oct->coproc_clock_rate); lio_pci_writeq(oct, clock_comp, CN6XXX_MIO_PTP_CLOCK_COMP); /* Enable */