Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3707744pxb; Mon, 24 Jan 2022 15:58:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHH0nADP3JR8AgoVhO+jI4ArzyNJf8mktzv2voZvP/zxo8SrnRGDOffJbkKhRlKPLGUlNY X-Received: by 2002:a17:902:a417:b0:14b:1f32:e926 with SMTP id p23-20020a170902a41700b0014b1f32e926mr15559471plq.170.1643068703825; Mon, 24 Jan 2022 15:58:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068703; cv=none; d=google.com; s=arc-20160816; b=BhlW6bJ+1h2CRRAt/53jsKmWaEhEj1p0FfpXay91253IQWMkN19UEarKYcptOImba/ PfGP9BPh/WUXkUne9sntZYwXFtI/Q4/FCG/fw+FEdJsc6oiiItLijRd5hXQm0xBN0rWo 8C9ZdwoH2rz6tMayFF7pD6jl5NKu9S6XlJmtFdUidPm6nV1arfHS2WVPMKRke1CF+vyG FKak9bryY2tFuAapVhCcnSOScvL4EmKhnwsDpbn+9ejvVCpiw4tunkbwT9Z9AylxxOja 2nT+z5vKSNx3kbTtyqRJ0II+ZW30w5ZMXa/3o5n6in+vYSLaQGdsVZH/ozqAgEpbe2tp fgpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Moe5PRX+jD+tK47jFkJ4DgbwxWrDOlWK00Fa/6zpvQI=; b=zPplZWhr0X94QZpU9J/FsAKJN4k+HF+jr1fbhmZm+IiWza5C5eQ1y1zPfjFPNQtGSL riy48/Q6e/gAZiHNP/hkWn+Gakz7xgP4RNNcIC894WffrVIUIF6S6ESiKvIdRv8f/OpI mgHwuDbcJ1/W8Qcy1sOjcAGAj38ZMO/tBhylsuhvXMb1sVRb8qjCd0VbN01qfSNEWH0B f8OAr88e0q7aH4bsAHdMAfzqAB8CAruARHdTs61mzjCqMtJMDxKik4X3Y359r0mLTA1S Vd9+Zz9EcIE6SmQ/Izq+Rnop8WmYUPVZdJNVGKlQ4A1ZWUkX+T7xZBI9GX43p4Y0tpdB P2kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RloTmhDm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gp8si608175pjb.53.2022.01.24.15.58.11; Mon, 24 Jan 2022 15:58:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RloTmhDm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2366600AbiAXXxI (ORCPT + 99 others); Mon, 24 Jan 2022 18:53:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846012AbiAXXOO (ORCPT ); Mon, 24 Jan 2022 18:14:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA53BC06127C; Mon, 24 Jan 2022 13:21:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 87112B8123D; Mon, 24 Jan 2022 21:21:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8B82C340E4; Mon, 24 Jan 2022 21:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059316; bh=oLdh2IIQhyz8/cfQ/4uNzzA2+eaqF5O7TwGmsi6SxmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RloTmhDmexkQTyXWfIMzeIqlbeRx/mtmhbzPQuoJfD4RYOF7Ca6xW1gDBO707eHsP XEX6ogQO0+ebhfJ/QxRzKefaEFd3i0oEmeQzOlF1le+gPzy55A6qjNtVXki2xE2xKN pWIdow2TLwtETOWUJ++5+b9BAu/6IJlsVXeTD6tY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abaci Robot , Yang Li , Geert Uytterhoeven , Sergey Shtylyov , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0575/1039] ethernet: renesas: Use div64_ul instead of do_div Date: Mon, 24 Jan 2022 19:39:24 +0100 Message-Id: <20220124184144.674393499@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Li [ Upstream commit d9f31aeaa1e5aefa68130878af3c3513d41c1e2d ] 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. Eliminate the following coccicheck warning: ./drivers/net/ethernet/renesas/ravb_main.c:2492:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead. Reported-by: Abaci Robot Signed-off-by: Yang Li Reviewed-by: Geert Uytterhoeven Reviewed-by: Sergey Shtylyov Link: https://lore.kernel.org/r/1637228883-100100-1-git-send-email-yang.lee@linux.alibaba.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/renesas/ravb_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index b4c597f4040c8..151cce2fe36d5 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -30,8 +30,7 @@ #include #include #include - -#include +#include #include "ravb.h" @@ -2488,8 +2487,7 @@ static int ravb_set_gti(struct net_device *ndev) if (!rate) return -EINVAL; - inc = 1000000000ULL << 20; - do_div(inc, rate); + inc = div64_ul(1000000000ULL << 20, rate); if (inc < GTI_TIV_MIN || inc > GTI_TIV_MAX) { dev_err(dev, "gti.tiv increment 0x%llx is outside the range 0x%x - 0x%x\n", -- 2.34.1