From patchwork Mon Apr 29 15:05:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13647205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A60FC4345F for ; Mon, 29 Apr 2024 15:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ckpLMePUoEkZyIedBfYkBAPdmV+/tbMx3ksnX+lyDyo=; b=0xA5YhOQZTFNqv bNgTQ2osU3xZqeBa41PiOjjhQjE5/7fX+RaixT6+B91zb9Ep6CVCp5KR8FUv0GM5ZxcJhyI0deRqK MmjkjngXo2+NuqoPoXL+6/3knPzUOxXHqXMPJkoUwpJ8pBeSnQUfy8/2PwIvfnuouYCwWbxyxbT9q gDyqe0pdmz8mp242KHLgKAd5Mija/BDt0ONdQCMBqs9tico6G5mX1pZma+yetyEoV/Y9oYzIEr7C1 BXfegVULGslogJ/7t+oYDMsgXeWiVa8G/y1nyCxDH6n5RHrmMPtjft84Iwzivh45y6WkgW3qN4Umx Apwoq9yzClhtEXefKvgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1Sdz-00000003Is8-3T4d; Mon, 29 Apr 2024 15:10:15 +0000 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1SZ3-00000003FbS-1Lpu for linux-arm-kernel@lists.infradead.org; Mon, 29 Apr 2024 15:05:11 +0000 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3c750fd1202so2703217b6e.2 for ; Mon, 29 Apr 2024 08:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714403107; x=1715007907; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sSE1LZ8RJP6sIAmkq+8umDfF5CuS0FK0HNlyLUmOHag=; b=BpGdNNApxnXWD0zPMuzZaLNSVd9UTRWV3qIHg/Oiwa6GjEnVdUT7Cn4VvgltnUVQ/X N+ycV8UqyTNozD3BIL0WB4ZGwzelA0UHmKi6cHn/EVaZ6BakDcSJ47dWIP17Z4ec4cE5 DIsIAd7CZCxtilyDnEHvWQwfyr07jaFPSiCoY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403107; x=1715007907; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sSE1LZ8RJP6sIAmkq+8umDfF5CuS0FK0HNlyLUmOHag=; b=Nx3zN7Puu9zJHfFaiZOxv+k3U+nLBthPSGE5/TKJ6p2mgMc2P3tqTOjrLJe68mUT2E OPerqLt5gDhSBv/JXeqZ1B7EzvQ9MCCAmHwmFaq1+E0vfcYMcSyytdJaj4ZTkxjWnII3 +HGtVG66yqDThHdRcoJ7ZAWEjmpsf+FX3agc8drZtaJTdeyJ6P9c6nxkrxaPUuUmC1Kt 5MTfIAFE16cBmf2c2afFWL+E95BZfurtwymVXpfxDXRPZ1TOjFdLh0hAR2ZO/aIHKRUA I3mlPdYCCc1+Spp1BItS2P8rRY6ZbTlWGHsS0m7KZWL8HXYz0XLt7wxf/bvuy2rmA36f fhhg== X-Forwarded-Encrypted: i=1; AJvYcCUWJBBHxaZhcfiEhf8lFGZ6Ae1+7jgF+laFBmEhv4U/qLik1pPHbKuWuFKpQPlJE27+Gy4tjZgRnAaK6zYTe5yQfNoajyDZyF4chLmewBpbLJMDrmA= X-Gm-Message-State: AOJu0YwBl4YmMeErARQDClJRq2u1thBfaE3q2P/cdQlEyVIIFPypIBST HTQtZEo/eKHcJsva29ujiDFwpr40QO3FpISBEi2OrOmM67cBnE2bE3U1ngkxA2vQ8dFTCaz7TNA = X-Google-Smtp-Source: AGHT+IH4U39JmXtitBebyQXf3RiEBhrVCarSNwVpuxhIdD3y/YgatSZWK47F6u8fGZIDpkmTeNgcdg== X-Received: by 2002:a05:6870:a70e:b0:22a:9c40:3782 with SMTP id g14-20020a056870a70e00b0022a9c403782mr12043126oam.11.1714403107649; Mon, 29 Apr 2024 08:05:07 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id p7-20020a05620a056700b0078d3b9139edsm10568591qkp.97.2024.04.29.08.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:05:06 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:05:02 +0000 Subject: [PATCH v3 23/26] media: venus: vdec: Make the range of us_per_frame explicit MIME-Version: 1.0 Message-Id: <20240429-fix-cocci-v3-23-3c4865f5a4b0@chromium.org> References: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> In-Reply-To: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Hans Verkuil , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Benjamin Mugnier , Sylvain Petinot , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_080509_637732_B250EC47 X-CRM114-Status: GOOD ( 13.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Unless the fps is smaller than 0.000232829 fps, this fits in a 32 bit number. Make that explicit. Found by cocci: drivers/media/platform/qcom/venus/vdec.c:488:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead. Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda --- drivers/media/platform/qcom/venus/vdec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 29130a9441e7..2b2874aedb2d 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -464,7 +464,7 @@ static int vdec_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a) struct venus_inst *inst = to_inst(file); struct v4l2_captureparm *cap = &a->parm.capture; struct v4l2_fract *timeperframe = &cap->timeperframe; - u64 us_per_frame, fps; + u64 us_per_frame; if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) @@ -484,10 +484,7 @@ static int vdec_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a) if (!us_per_frame) return -EINVAL; - fps = (u64)USEC_PER_SEC; - do_div(fps, us_per_frame); - - inst->fps = fps; + inst->fps = USEC_PER_SEC / (u32)us_per_frame; inst->timeperframe = *timeperframe; return 0;