Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1800851pxb; Wed, 9 Feb 2022 04:57:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKB/lf/lHsNFGxpO14w+zA3jh32JJj2xX4HLNxLAHmN4MQZtWkNIghrRu6TYHELyK+yXnA X-Received: by 2002:a17:903:110c:: with SMTP id n12mr1968938plh.127.1644411446198; Wed, 09 Feb 2022 04:57:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1644411446; cv=pass; d=google.com; s=arc-20160816; b=PC+C5SZwK9cEB3oQCV3bPANiS0qRRNVM+nJXUwum08XVFzWZN8+S4LqR6955W+YdHA ISqA0VZcZEXja3RsESQlEwpg5h0Uy5ZqsutnAx5xUgMDQROcW1juuZ3Tv9I15u+D2v4n BSY1rhPsEiT8jpBD9iVKXAr67szGuI7MC5f8591GRnoP/XP/GrYEeq3DGc0fEG//rp9X JlOLsTi9QCeQIVyFhXTjpweEj/7wL5kx/mthAL3WbbFcLxb0PN7rD/+FQOKtQ3D+XL4D RAG7CVdyeiNJelIYZ9sBlerJglzpAUjud91eUoYx7jFBk+PTeHvH5kf+Ia+gT9gxR48J ZTvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=FcofcH7oWcl9gYQuZKn7nBKawRC06+c5Al1uGbhWqHc=; b=lSoF+XGuKDiSVI32umtyTIYdXhlYU2BnYZynW9IXltF47j2BK567JpNzYoGOJBC7mV FA004QLqeBkO4VvLqd26VbcA+auFoxItQgv7KesQC82ww50Wu7nffyyKanif19NFmlM/ I3F7n5cRUx2wt/5IVEIfAEPGsNXLLKw80eX6y6DiCyOIb7hdoYJKf8dcNTl1yt0kKw7s FNyaljuViwx5AMV6Bo3TJsCOtn8bX+n5LAd++vndE8IL4gweHKuu+AV57X31p09dqTrz Vv68gDjb5JGkHwfjXTcz5eguJfs3ug0cD/AteFdM1MXPbDZzLyj/hCsi1GhQrZfxXeJT nfEQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo0.onmicrosoft.com header.s=selector2-vivo0-onmicrosoft-com header.b="H/HmmzFF"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g8si15484958pgw.687.2022.02.09.04.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:57:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo0.onmicrosoft.com header.s=selector2-vivo0-onmicrosoft-com header.b="H/HmmzFF"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 30A0EE0A56CC; Wed, 9 Feb 2022 02:32:57 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241907AbiBIIj1 (ORCPT + 99 others); Wed, 9 Feb 2022 03:39:27 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:46592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231598AbiBIIj0 (ORCPT ); Wed, 9 Feb 2022 03:39:26 -0500 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on20718.outbound.protection.outlook.com [IPv6:2a01:111:f400:feab::718]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73A39C03BFE5; Wed, 9 Feb 2022 00:39:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U+V7vyt1YyfLST49InkHnIlX1MKmIJWgLv4GJ1myoW98b7xEzbOzpoQ1EkAdnXWcp0SyYa2mKsJ79tj0/Ve7RcKO2B2gi1mIK/gzDMB2p4vyeLQttkhQwSEqlgKPEdUdzE02o6I48JI9tCHKbdw5ZDAzBY5T3QlKgDfDr3gdeb9ZCx9h4l2aNATguvsqCQOIax/OWpBxOyV6xXV1ymnQ2p6fTXxQ3SHBWh0r6hLuu7LsuGAdrO16OiAsy7zPKcBO70iIFAUsCaukO4CXp5M4k2EMbVYOVfHGqf20zZSE6pFq8V4xduc/82YQAtOpjtE5KeB3bVzOro02/8+NYguCCg== 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=FcofcH7oWcl9gYQuZKn7nBKawRC06+c5Al1uGbhWqHc=; b=KXDDd8uPtl13Lk70jPOXV0mtfkDrKLgbDvY+IkSQOq/W3eUrhUdcfbY/Eh/y4hQTZZ2oEk1Re0m4tLuySj5Q+Oz9nHE0ChNJjfS3GhdXe/h+bj9Rvh+LGovtuPQSH2xOb6AhXR+rNcQpJ3rXL6WF+lSygI0D7BgXvRmxd/aaSvTH4MrGvhAkp9m8Q3PS4cyguwaunM3YALY3rV+gDitcgTjl1PnQSeK37o95XvK+Kk/+NllTG21PHdj5nTmZIQWtCl2IprErAkHjUtlF3k58lTVD+6u495YGJrS5z8VF/GWVYCWzqYvI6vo+aOXgh0Ll7IokUPPFgglIt+mTP+mlwg== 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=FcofcH7oWcl9gYQuZKn7nBKawRC06+c5Al1uGbhWqHc=; b=H/HmmzFFG2/z0Z/t8SDHiow3Hn67pqE8/I+V1YAV8DBegF94yguD0Hi+22UES6L+AUiuEMsPj3ZduxZAgdaYNMk9kSBy6/h5ay27vCcVDHEfNHVCERB7bA79SbMofP6gYAg3Cqi4Szi4YPabDW4XsoWCSxbWBwzsMXRaqkJT2cw= 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 PS2PR06MB3559.apcprd06.prod.outlook.com (2603:1096:300:6b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Wed, 9 Feb 2022 08:38:26 +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:38:26 +0000 From: Qing Wang To: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wang Qing Subject: [PATCH] media: dvb-frontends: use div64_u64() instead of do_div() Date: Wed, 9 Feb 2022 00:38:16 -0800 Message-Id: <1644395896-4036-1-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: SGAP274CA0022.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::34) 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: 5c0df24a-1643-4ce0-eebb-08d9eba78a07 X-MS-TrafficTypeDiagnostic: PS2PR06MB3559:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BdGSQQ2ije4BDtt9jyU3+ajz7FXzWKownGXw3+BryXPwu8Ll3iL5URh1mytOdUGg/J07pqx1FJJGXPcbjRtqFrMXlVJHWMHy8oOCjlXqcGgj1/+Vx0DfS1/3vwQBCwcw9dO6dXOi3mGsH87HvQfnBczuN6VYQnkXJTOM6U8gxAY6pOdOT1aN77JADdiBnK/k68OdnhyuifPhA/GXWwHA/Jq/We/6kxiGFDSegu4SSfZuF27tCtwNINwsKcuc2dAXvX3hStVVtsH6yF6kUimkKuI35BZXTDxkubBPin2xyo6BFLA5MVI1FLOsJBN/2LEAsGRrKGecgsqoGa3cErGpiVsDdS2GAjo/1+7o0o9cHNHdr9f4SJOaQncA7O9IwJY8mNt7VeKNuXeJocbjM33SBweUA/SIKrib+boGFaDRFnNa6PaEgQvRU9teAFypOHkLumj2YxrUnRTfHhkJVGJOMffB25AB2sDPwvIzDTdRMzfzbrh1WcKXNUNYDVbWtyEc4VGKfAk8PKwWRWd4Nhskyd6QZI3lpJMJkGfHF/+bYOSp7Ss102mnSYoVokEdBJUscYzFPZdJvlcHy0timCfj3WuHE1cCjhF8gQ0bR4uNMP7PYcbp2tmKz191t74X9cONuaGg0vDzEFNUMuHc/IgZ8xhwPYg54vVMHc+mkzKWOHXTEQ2HDEK7olG7KjmD8+sRoylWXo8IoxZpUkc38yu1Gg== 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)(2616005)(8676002)(4326008)(66946007)(66556008)(66476007)(186003)(26005)(6486002)(107886003)(6512007)(38350700002)(6666004)(86362001)(6506007)(38100700002)(316002)(8936002)(52116002)(508600001)(36756003)(2906002)(83380400001)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Z/zy6WlRIzoAl9PvZA2o5+dZPC9On/eOR83pkPqBhhkM8EwqV/8YTXkVptq/?= =?us-ascii?Q?CH6qQxraj2YZz3m/N2ECqPOJ+Q77mRikY0yh//Gg9qKxdzTUGrht2dZNxl6d?= =?us-ascii?Q?xou11ueR7lexMgX1hHyRn5o3hMsX6iO6ECLuy37mbYqJKtVGNoNjY0AYzR54?= =?us-ascii?Q?cxUS/ZMz0enmJlGv1vgl51Ryf9bQPYLoTS/+FzBu6ilD5W3cfOpbmzcAVEvi?= =?us-ascii?Q?5C2dcZ2+PZmVGCMjilmNEE7E4Rftn8wX3DBLBxEUJ6gGiXah98NK/3/+krJw?= =?us-ascii?Q?GK1/R2/p1I+yHOsVBwIDGT6XUitIULJx0TpOlJd81k9IIZsMmJTbL39QV7yZ?= =?us-ascii?Q?xE93nEnmFtfSHEzzYaqKFLL+FFEXj363TQ1gEFbAN4NxB3jLUNlnOxl5wOKQ?= =?us-ascii?Q?b5A+fvvXemLR8RUabSStPlJMKxuQg7BQsqDXhFQvW8GecPJDNay3hnO2MevN?= =?us-ascii?Q?sE/aiQFw0qpDwsEXmjESkBGIAUSHFgNQS70QCM+qF65EHYd4sYw3qy2PLH27?= =?us-ascii?Q?zgRwzazrRMGIxriTMPeUVmn7yD8u/z/bg3y3xzyDVv0ZGGDDQiA3ce/Nx2j2?= =?us-ascii?Q?F2aK3SYN5k9wvo2pS9XkLJwBsXetC0o3IQL37DAjHmFakhd6bGKgwtgFP9K6?= =?us-ascii?Q?C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8VpbmvP5Q/DqM?= =?us-ascii?Q?PFGhRq+QOG6RtOReTe4u8WWokKHW+gRsjliSnagafhroQNndO2a6XDuCgDwi?= =?us-ascii?Q?cT62WDY+/JHtN+4DUetyD2Q=3D?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c0df24a-1643-4ce0-eebb-08d9eba78a07 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:38:26.0133 (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: awQKXEhdgbb+DZKJfWXnyPeNSaR4QHVrFgHUh2gCd22xuQjofCkOH2pPooBpsVyit7bMH4uVCJQRfKVsW4BGAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS2PR06MB3559 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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/media/dvb-frontends/tda10048.c | 2 +- drivers/media/dvb-frontends/tda18271c2dd.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-frontends/tda10048.c b/drivers/media/dvb-frontends/tda10048.c index d1d206e..1ce2e67 --- a/drivers/media/dvb-frontends/tda10048.c +++ b/drivers/media/dvb-frontends/tda10048.c @@ -344,7 +344,7 @@ static int tda10048_set_wref(struct dvb_frontend *fe, u32 sample_freq_hz, z = 7 * sample_freq_hz; do_div(t, z); t += 5; - do_div(t, 10); + div64_u64(t, 10); tda10048_writereg(state, TDA10048_TIME_WREF_LSB, (u8)t); tda10048_writereg(state, TDA10048_TIME_WREF_MID1, (u8)(t >> 8)); diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c index a3483448..fd92878 --- a/drivers/media/dvb-frontends/tda18271c2dd.c +++ b/drivers/media/dvb-frontends/tda18271c2dd.c @@ -328,7 +328,7 @@ static int CalcMainPLL(struct tda_state *state, u32 freq) OscFreq = (u64) freq * (u64) Div; OscFreq *= (u64) 16384; - do_div(OscFreq, (u64)16000000); + do_div(OscFreq, 16000000); MainDiv = OscFreq; state->m_Regs[MPD] = PostDiv & 0x77; @@ -352,7 +352,7 @@ static int CalcCalPLL(struct tda_state *state, u32 freq) OscFreq = (u64)freq * (u64)Div; /* CalDiv = u32( OscFreq * 16384 / 16000000 ); */ OscFreq *= (u64)16384; - do_div(OscFreq, (u64)16000000); + do_div(OscFreq, 16000000); CalDiv = OscFreq; state->m_Regs[CPD] = PostDiv; -- 2.7.4