From patchwork Thu Oct 27 21:59:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 11997 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp475452wru; Thu, 27 Oct 2022 15:01:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hf98kG28K2mwC6luQrqgoDKuF4i54R16LWEaBpdqO8VqftJ1wZMSJWhXV3QmMTM9/90+p X-Received: by 2002:aa7:d889:0:b0:460:62ef:2695 with SMTP id u9-20020aa7d889000000b0046062ef2695mr37096416edq.273.1666908074105; Thu, 27 Oct 2022 15:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666908074; cv=none; d=google.com; s=arc-20160816; b=UG+GZ0ocCU0y2wX9pTaN0yUG3XL13ItHgqsQ/3fGjcdgAraN5lTEi+pTDLtONrgyOd ougS9YWmscxGCqQCG8eF+8gJ/v/Tyl4LW5KMg8g7gN2nrpWvGcR715bCTVDM5Hx/yrQo ngdyBwTI44XFpvKE1kEyJreLwmswuXGnFzWD7kGIedyAEj1m5+PXXlbMdqN9K1a0VVXH co3etIjfMC3DgQcS5Eae10GpWAV/6andM8boddzwwlz8HqpVz8X7FJ6LvRzEUB/Ycspw JJ0yqFWuMCf+i0oXb0phM3FGLVa9Vl6ADwRChftWh/tkTNO8YErEbGyiH5Rmq8VuZc1R Rp+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=CK+Ri2zYRLJAx4kmwPxWBGtH2FdfNDyuaVdbab83QPg=; b=etn/DjJsFnWIxlXcvbMYWvTPBKtFoLzX6XP/cmDZ2b+/d/N9pOG/+vpP/Y/Ij0pnTV s0R3bgXBxeRcQcjUvvIyW7Vt/+eCHfKvJoev1PDdnE5b+ptJxUIvEEp8O5hGTeINxMGv 7AWImLF7vFQxFDELOri0K423HGJJ6t0MPaCgXpUk1jRJs8g1shrNwdK0a6bp1zUc6zpr kTLiNCtCAyi469tMCTx4u52rM2m5A6pfw3DN7GxsMU6cFJh1JJ/CGZpsndywiUU8kjWw 9f+zyUczdQJ6m2xLLqw/Av9fUKkzzxfJQi9NjM8VtlFLhOqZJbkgwohyFJmckondJLBv BT/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=EhiA4AHs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020a170906135000b00781e6ba94ffsi1774671ejb.126.2022.10.27.15.00.50; Thu, 27 Oct 2022 15:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=EhiA4AHs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235168AbiJ0WAJ (ORCPT + 99 others); Thu, 27 Oct 2022 18:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237192AbiJ0WAF (ORCPT ); Thu, 27 Oct 2022 18:00:05 -0400 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E4AC1E73F; Thu, 27 Oct 2022 14:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1666907978; bh=K6jkaIWLjM8amIf1/3sGKi76LC/AewW04KWQY65UKW4=; h=X-EA-Auth:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type; b=EhiA4AHsTTAS+Eve+c+tPPzPBk4XEFkyguh14hRkAHRwMxzOpas4XNSLmKADx553e V+VlYpHUhA6fWSZ/Fr4XnDjrbbpIKpWNXpgr/so07YXy4YIdA6TI+fsCEpAh51pXTW ebmS/OTl3eEmGDu4/n4N3QIX6oXueJi1rfywKEKg= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via [213.182.55.206] Thu, 27 Oct 2022 23:59:38 +0200 (CEST) X-EA-Auth: gPds8du2GN4EigpVxAh6zYgunt9VQITGmwhvWpkx/yxVDikGFU9mBoo7as8yKS+di+ACDryNiOD5yTMHezgeh8p9CD8AOADG Date: Fri, 28 Oct 2022 03:29:32 +0530 From: Deepak R Varma To: outreachy@lists.linux.dev, Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Greg Kroah-Hartman , linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2] staging: iio: frequency: ad9834: Use div64_ul instead of do_div Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747879497834867884?= X-GMAIL-MSGID: =?utf-8?q?1747879800778701182?= do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation. Issue identified using the coccicheck tool. Signed-off-by: Deepak R Varma Reviewed-by: Nuno Sá --- Changes in v2: 1. No functional change. Include outreachy mailing list on the to list drivers/staging/iio/frequency/ad9834.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.34.1 diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index 285df0e489a6..3917a76e7976 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -102,8 +102,7 @@ static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout) { unsigned long long freqreg = (u64)fout * (u64)BIT(AD9834_FREQ_BITS); - do_div(freqreg, mclk); - return freqreg; + return div64_ul(freqreg, mclk); } static int ad9834_write_frequency(struct ad9834_state *st,