From patchwork Fri Apr 19 09:48:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13636106 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 89014C4345F for ; Fri, 19 Apr 2024 09:53:50 +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=EcmtmlWUk5ECEBEBVkiYA+FxALAlsGW//kSh/Y4GRq8=; b=NP9SiPSe9F8Ud7 HD+4w4YjyrZqhrHNGsdw7AZ7IHGQ1ZA1B/AWanyn9ALGI/kL7RLX//0yAEjQRnXJlgyi81tIt5Gdt b5wZ/bMvhLEYjAzd6LPXeUoBDhy0BL5S68UEa1aiDtdOFwpqKA3QHWlCB4Nv3/eunHpXfEjSeoNMR LYuiU2GYrrvftB/rpzHp94JxZMlxAXSoaLIqE94jZupiAcsZmLUhjmdqm6hRzQu+QUfhylrtfHVcL 8xCIl/+c00pJV+x594TtN3kztPhxuFT7osyPditr26ghOLYVMhvPsQipORyQApc34oxBQMoTDp6hO Ng39FRJhsX+8Ii2OGHAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxkw8-00000005BPd-0Wu2; Fri, 19 Apr 2024 09:53:40 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksY-000000059Ki-0Ada for linux-arm-kernel@bombadil.infradead.org; Fri, 19 Apr 2024 09:49:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=lvwwtJ325ZfoqM3HPbRlOXyIZjp4qomL5UkM84Use0I=; b=GiHDBUm/gSl50IRBvmySyiwcRo hacakxHgk5Omr/wKv8hGuRUtVyfF7a9hwzFPr1/Um5e5zMoqN6/93P8o1eHM+4p7fpSH6PqrS8hE3 JKKEFx+2Qpsu9E4DrDGPeYmcik3fxzkNPrmvDLEu9I/MHS1LgmcBI4VChaBe4b0diHr5UZm47MnCt /wb3HAcjkeQHbmiLLuxQnqcq5x8wh6g+Ef6c0xE8avmTSHhxJyqoOn6mJ6tcmG1QINeZ+zMBvKsMk 58K8Y2ec3SuO9ciK1Va9T/nZRUqIHSi2sSalLZk0O/cC/GfphGX9z5kqyyXkHphVqPG6Xzwyuv99E hoP3FW+Q==; Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksS-0000000COTC-1U41 for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 09:49:56 +0000 Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-78f0593f45dso121297285a.2 for ; Fri, 19 Apr 2024 02:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520186; x=1714124986; 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=lvwwtJ325ZfoqM3HPbRlOXyIZjp4qomL5UkM84Use0I=; b=mcC9omfcFrSUs5rKWG1qTBfksUCA2zQLuWJ3lXbE2TwZsENk6kk98u4I+vHQQV/Q9b vg4QXjsrqOUNAhOfVOvb48BagfnH02TkPGa9RK9GfDle+xO7QjMKPe8962SoDSQlBEn9 4qJOQPdtOk5I2XQZxt9vpnN+NrW9smgBvz/2Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520186; x=1714124986; 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=lvwwtJ325ZfoqM3HPbRlOXyIZjp4qomL5UkM84Use0I=; b=c0ycVfvMv7o1XRMYANVugsLZkAukKX/2PmMcOPRc152Hfq+i4tUbFN6lvZQeYO2lT7 R2wHmkror8cZXzjgHYEaRxaU0cuOgimpAf3IAHy/ez38UvtbrgG170mqiyixyNRpyPQQ B3TWbsXvAvOOjtYPqQ/ajHq3piOev2aGPKKV3tnwiTl/tKXtObx9opScClEgV4hCDmXN vdRTJnjbkbe+e+mHmhqY2Gue1pL1bfILT6GuGMgiewFU8NuQoOo9KGGPe35n+94WGliE 8pUy5b8a1q7x5bEK3yzRJqrsrK5acggA6SFw52AGtvEOV3khTsWJIoc1Kav/cmSEOUtH zS1g== X-Forwarded-Encrypted: i=1; AJvYcCXbs0u0BgjGm/aPvOhi8xDYMAQX7YdhcpOpcIn2saQOxW1wBWeVO9RNJfguRFJWWqWG5SZrVhADGI8o0dcWPVznn/uWROm8QOOtgLQLKjbBxPy5qL0= X-Gm-Message-State: AOJu0YxXex1oip9t0ptqUVb24kTyDeF28gFyUA2QdOBTAfeE4H11EsWq OwDeQnxeXc/HfVKmLS54dm0Lu80Btc64LGdZ6Lbs/+yliAC1QHOMYJp11YNWow== X-Google-Smtp-Source: AGHT+IGW/Q/7qXEnuhzqs7M7AiVQTUVEbbMcTlOeO8lJn5AB3n8uUiRJEECQ6N2ghfLB4OyUBOtkcQ== X-Received: by 2002:a05:620a:1238:b0:78f:1622:5a96 with SMTP id v24-20020a05620a123800b0078f16225a96mr1817957qkj.39.1713520186635; Fri, 19 Apr 2024 02:49:46 -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 dt14-20020a05620a478e00b0078d735ca917sm1434532qkb.123.2024.04.19.02.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:46 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:48:10 +0000 Subject: [PATCH v2 24/26] media: venus: venc: Make explicit the range of us_per_frame MIME-Version: 1.0 Message-Id: <20240419-fix-cocci-v2-24-2119e692309c@chromium.org> References: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> In-Reply-To: <20240419-fix-cocci-v2-0-2119e692309c@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-20240419_104953_360169_7653DC16 X-CRM114-Status: GOOD ( 13.15 ) 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 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. Signed-off-by: Ricardo Ribalda Reviewed-by: Bryan O'Donoghue --- 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/platform/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, struct v4l2_streamparm *a) struct venus_inst *inst = to_inst(file); struct v4l2_outputparm *out = &a->parm.output; struct v4l2_fract *timeperframe = &out->timeperframe; - u64 us_per_frame, fps; + u64 us_per_frame; if (a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) @@ -414,11 +414,8 @@ static int venc_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 = USEC_PER_SEC / (u32)us_per_frame; inst->timeperframe = *timeperframe; - inst->fps = fps; return 0; }