Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3384680pxb; Mon, 17 Jan 2022 19:14:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0+PiMkwPsR06N+eEuyuoqF5QKbhNXV6CTaQiwQjs4mj+iGIfsJuz3qqHh2AtDBKjdOimV X-Received: by 2002:a63:6a09:: with SMTP id f9mr10522209pgc.533.1642475682432; Mon, 17 Jan 2022 19:14:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642475682; cv=none; d=google.com; s=arc-20160816; b=PxgafMj7EcHP0oV/t6e+nK4Q/ulz0vhEGvkcanZce+Siwo0WGzR3s/MRwCxiTpJpV9 cUwBjBIY008ULE0OoAP3SMWAydBan9o6fzu3+eiJawAaJLKY4KCKLTIVJw1cRnIUhS/z XN81jrVD2uG5wILDVY1O3aBX5Fp+VzaKCHutzPcO7hKgcFr8wSv4nBwIOLbpCSxaq90d iGhaXPOoLJUmLR8VadSMR+hc6XkOzI8WpN9WkxMMvZ7C+nwZ5UWTXukPVFGn4c93BL0V UqXuzudgKbYo4YMOj18ia6l0XAURC2AKd8VuNZEK0josNW/E9+ybaT3QbuMGEQKp3h6R 5Edg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Moe5PRX+jD+tK47jFkJ4DgbwxWrDOlWK00Fa/6zpvQI=; b=dJz8tEurubPpdKLol4+L/8Md2rDJi38LxaLRBN3nH1yPShhwEock2JimXpq2TMxneE i0OKjH4rpJSrjXYqkcuQqlZAOeTqr4bqoe1zy/Kf8ZdcxzGRJPK7pfBRchJlqbrqa8nK drP5g7PN2EBH+p095uki5zgekRs0amWZI3coY/BiPlGZOY+lSg41ZI0M366SrT4uk9HX y3FV2GAp1lMYBejngZoNxirAjeNge+3+tsIkVJmPBPAG86PW3baof3XqyoPQZU0eyzoT 2smDiHoDbJkmuk8/fNk+Zsh6fdt19VJix8bL+wOEBHoLwjvYHP673lmpHR3BeNb7rTrQ iHZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dYBNbqlC; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si531976pll.271.2022.01.17.19.14.21; Mon, 17 Jan 2022 19:14:42 -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=@kernel.org header.s=k20201202 header.b=dYBNbqlC; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244970AbiARCXr (ORCPT + 99 others); Mon, 17 Jan 2022 21:23:47 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37140 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244903AbiARCWk (ORCPT ); Mon, 17 Jan 2022 21:22:40 -0500 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 04BC9B81240; Tue, 18 Jan 2022 02:22:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A057C36AE3; Tue, 18 Jan 2022 02:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472557; bh=oLdh2IIQhyz8/cfQ/4uNzzA2+eaqF5O7TwGmsi6SxmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYBNbqlC9W8U3TzYkHpuR2erQ/eQdByLloStEOfqG7vJQfizOxndINIO4MMsQIMzZ vtcmS9hVii1zudZNSrawIFCFduERmTxpaH8EGtBDiualMhLn4Gi3bbB/PrRe+4OYsu 316znsywo5wc1jFKHXdzv1v3qMh9rngsHtj2FzwyuTQgcJaeRYKL03+zO57B7SbzEA 9BdSGGxJijMpJYqXSn6RQQSNP5la1NIv6qX8ZTzE+lgEBAq5VtON7uhb8nYrfKacK7 BxDqC/BzEUuQzHPNkdNtWWD3gmo2g2CTQLRbRPis34Uyi9ukULcwCIrzAlw13+unGY yuQM3LjPay1Pg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Li , Abaci Robot , Geert Uytterhoeven , Sergey Shtylyov , Jakub Kicinski , Sasha Levin , davem@davemloft.net, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, yoshihiro.shimoda.uh@renesas.com, netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 052/217] ethernet: renesas: Use div64_ul instead of do_div Date: Mon, 17 Jan 2022 21:16:55 -0500 Message-Id: <20220118021940.1942199-52-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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