From nobody Thu Sep 19 23:11:07 2024 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C92712AAF4 for ; Mon, 29 Apr 2024 15:05:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403120; cv=none; b=uPlSvzpu8SIrs4fj1bAI9dAJCbBA8tjhaaruB7UNqOlrnOnV5JyOPHl/V9Qtew3OwWc4Mg9qN5pNxgUbhfYZODJ5NjdK9I8b7UHmxvlN0L2gP66ysOd6oo8R51o4KFLaMC8RLB7SwXThnTUuLR+zKxi2dne5dreAPLSfxVKe1DM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403120; c=relaxed/simple; bh=lT0gv7t9lJl7WTpTFIwuHIIXL8DRSxK4u4QFsJzyT6c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U/keJwWJWwE4cFk2n4py4ke5imE03OQfJXw5oY7kT2ePLKShYjVsuTKQNmooaJgfVZu7z6c2SFXkglzDMWxgXrpKqFxMgh9O9Y8yPF3TAgYqqQP6iHFV3RNlGkfExMNZuMwz92mcr0M3IEosa7G4N98BrVqBRDDft9u+GsFlpI0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=O5mUMjqg; arc=none smtp.client-ip=209.85.222.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="O5mUMjqg" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-78efd533a00so336987485a.0 for ; Mon, 29 Apr 2024 08:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714403109; x=1715007909; darn=vger.kernel.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=WhbcF3TWQTA5MkpkxmSIX7qa4yJQy6aIRpdafwtebNs=; b=O5mUMjqg2A8YY4ty5orhIV1NF+pFi2j9bO9hT1HBhVy7haVjZQghrbU2Gh4yMmLPxN hnFW8xINxsvHuye4wGSsAfAIjVVKzPJKseKGAujJym+sf53HTSnDz0vS+VyLFaEYs2GL 89sa+G0eZib/fX6ppH/axvJUnVrvZTELvTt0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403109; x=1715007909; 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=WhbcF3TWQTA5MkpkxmSIX7qa4yJQy6aIRpdafwtebNs=; b=MZUAqcbwc9ctxFvzTeUu3YRT/4pZfIsY8tkix0B1LDw5t0uHSZ3w727md/CILqIRbD azcYFuZtRYHDXiwYqralywaTvOcjJgstpNlPuAyJYMljY21rSuYtzNOCh5j9BLwj2KU4 gHF4Xff3Ljlb3bPzDygSHaKPJtc79Sql0Qsv7rnHdofolHgvwB6p1szM7iEirDA9tysE uvDs9G9kyLIfOrBDUbrTT0Ixn6TJEsfSXgtEgKQ4jhdmKcBdi1CWcYYu1LBJEMOb4rKe YFrGG9b+PLxOiPuQDR4cZbcw6kQNVahCCKtCmq+5rTtKr7qo+YrgbHJPWs7bxytku8aY bQmw== X-Forwarded-Encrypted: i=1; AJvYcCXKXxFELJ1fwcYwS6FLKcj+yHYOHRCNaOOBXXqlNUuSh+98RDBjTXV8Ur3MIX6werug27iOLQqPGDmryFWKOq1zrrnS/YYYwoyURT+s X-Gm-Message-State: AOJu0Ywg7lSWYjbuwqeJ5jUdOUxkawCQNCtBDh3IonVlo8qQPU/vNfuN 9YbVRvFB/gexb7kbKzQdEL/Qr1SBUqyqpNYSAgu5g3pzq2HFfgeUMWHIuLZAFw== X-Google-Smtp-Source: AGHT+IGs4sEEfsd0KHK969uVD2lhoqcTxzDs2zjOqF/5cv6aPK5AvcxX8HFB2EOaJeVcr8eLM013oQ== X-Received: by 2002:a05:620a:8204:b0:78d:6479:7c39 with SMTP id ow4-20020a05620a820400b0078d64797c39mr7471552qkn.19.1714403109214; Mon, 29 Apr 2024 08:05:09 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:05:08 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:05:03 +0000 Subject: [PATCH v3 24/26] media: venus: venc: Make the range of us_per_frame explicit Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240429-fix-cocci-v3-24-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 Unless the fps is smaller than 0.000232829 fps, this fits in a 32 bit number. Make that explicit. Found with cocci: drivers/media/platform/qcom/venus/venc.c:418: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/venc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platf= orm/qcom/venus/venc.c index 3ec2fb8d9fab..f87e33a34610 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -393,7 +393,7 @@ static int venc_s_parm(struct file *file, void *fh, str= uct v4l2_streamparm *a) struct venus_inst *inst =3D to_inst(file); struct v4l2_outputparm *out =3D &a->parm.output; struct v4l2_fract *timeperframe =3D &out->timeperframe; - u64 us_per_frame, fps; + u64 us_per_frame; =20 if (a->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT && a->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) @@ -414,11 +414,8 @@ static int venc_s_parm(struct file *file, void *fh, st= ruct v4l2_streamparm *a) if (!us_per_frame) return -EINVAL; =20 - fps =3D (u64)USEC_PER_SEC; - do_div(fps, us_per_frame); - + inst->fps =3D USEC_PER_SEC / (u32)us_per_frame; inst->timeperframe =3D *timeperframe; - inst->fps =3D fps; =20 return 0; } --=20 2.44.0.769.g3c40516874-goog