Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3608183pxb; Mon, 24 Jan 2022 13:25:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLnHHRs09ahLMhuRtXD81lIW4FOhgPPjq2q/rTpDhFNZayXZQsp1VwUnI5SXeOlEKEUWpl X-Received: by 2002:a17:902:7fc4:b0:14a:9f3d:3358 with SMTP id t4-20020a1709027fc400b0014a9f3d3358mr16192520plb.165.1643059507926; Mon, 24 Jan 2022 13:25:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643059507; cv=none; d=google.com; s=arc-20160816; b=V9Ty30mLBS5nPlH76r2Syqkc6ZjU/KZmf2ieRLgDCcc9TA2n/gHlZNtBG4SBSzXCoF fU/7xdMLJkFUARCBqVUFCbpFkasHygG1Puvu3/8CBLodWHl72Zl2qbegOIC33WWFsJ+t YO+E+uc/juKmcW632VK5OEjZHaKe4z9RAevpNIdGQUqLGVqLhqMvt0zMriu1L1ZnBM3X FBv1GcGS2NWCO6I7T43cteSSC1F1FXKaNWiH35z987hCsApCrUTN4/3CE8ZHw5JxY0oS XVXew3SppKmVvKsdVlfhBX5r1nh5tGDf7HcvwPOWoXlTaMaZ9zKZRIzZ8QLXx4TcLGzw CiTQ== 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=Nn8FDCFaIYQ6I4oiHCnRRfRKb4B6Qd+Kf5A0HX0ttns=; b=bhf1iEqsUR/fxMV0L2AchABII333l4vkvinzKb8gUVGVoSCtxUCGTvPxXot+XUtaoV aggpM0HLnaHc84oTrh34uk5VnnTZoKPsURFz5Hka/pEfID3LTwYTdwbHfnkJOh4w8NjJ 5AdAV48SGycwSoL0gyP3euTX38NR8qQSYEESpgyJRgP72IVyZ+qUu1PXq9A5KRSMm/fh AtkUJZdQoFhf3i0+mhJClkuzpYvn8d/WEuaezp3qb0CiunVZUi9XtcenaUuQuIOYUbZ3 /BoRJFnmcyiPWt5wSoWRv1FgG1Havcr8goaUVSDBg0BQKXoe7KVbpP0CjgW4A011GNht 8frg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gkbvTp8P; 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 f13si14175538pgv.730.2022.01.24.13.24.55; Mon, 24 Jan 2022 13:25:07 -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=gkbvTp8P; 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 S1443412AbiAXU4x (ORCPT + 99 others); Mon, 24 Jan 2022 15:56:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38894 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385738AbiAXUeR (ORCPT ); Mon, 24 Jan 2022 15:34:17 -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 337C8B8121A; Mon, 24 Jan 2022 20:34:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E0CBC340E5; Mon, 24 Jan 2022 20:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056453; bh=nWfx+5I8ePLDtAMpHsHpCuInFeM3n1fhygFY6A3KG1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gkbvTp8PJEGzkv/ksLKXB7dzBEckWkPIoBnoe3hvz6i/oZowVQnKDS29QmpSKFMAm OEMbeZodYkaikKg990SMLt+CDRKABPEBjIoYrMYBAoOiwHL01cETRJNJbzo1xWnocZ kSb6sG2MP6v8TaExtdFFuQqEV+tyxACliFyM9pGU= 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.15 489/846] ethernet: renesas: Use div64_ul instead of do_div Date: Mon, 24 Jan 2022 19:40:06 +0100 Message-Id: <20220124184117.878667952@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 0f85f2d97b18d..4e08b7219403c 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" @@ -2061,8 +2060,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