From patchwork Fri Apr 19 09:48:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13636099 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 33BBEC04FFE for ; Fri, 19 Apr 2024 09:52:42 +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=epxPii6pYsCuproZKyPpIqHJQ/Rji/no4jXcsFMoFi8=; b=hKuHxxzFg5w0ar f6r92Nozn7IxYjCdjjnppa7Go4W3btQ2ECOAjeeRWsCHAYSnWfppQgoW5RLrZDrMCADjG8oVPLh2y fl6iOXUrLxfutzxqEk6DMBIrMyDKmjNn7KmIBCH3QTLb8Mk90/xBr/rv4eAbL9i310umA8TtcudWy e7jJIMUdIsdwylmeSC0quYDUstqzQNzZEFoMf8ypxvQBesNg0Xy9axJ/nL0qL1Nt0nEgVnxzKgjX5 TlGLjgJ+B4Fjva0c4Yefe4W/aVlqvyW6u4YkTaN+M6pUrDxLp8CxlMLerBoquh3/kFP07JQ5XBlDl arHSFAvvjshDbyJXuOWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxkv2-00000005AkG-0XQg; Fri, 19 Apr 2024 09:52:32 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksR-000000059EN-12ii for linux-arm-kernel@bombadil.infradead.org; Fri, 19 Apr 2024 09:49:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=G+OLGyPz2NtLOZH/YOdUHJtasX7vVXp+smN0A8Fakk8=; b=snTHB105Jv7zrzbwqF+jyelGtr PafQtey54BmmBMqFMMRxUmgq0ixmyvXtuTm0xklSKDEDwcGrJxFH1PtS5vB9dqiV6x1jRZxj6uFvJ 9SBq/WOqt792AGbw/2MQMereFx7K1M1H9AMkmsBqIrDxDFvnLZTQdR4i6XwturF0IYQeOHoJBDLph CCgxH6pcNjymLm/VuYQSpnhunhtvn3f01J0vemshqnL52L0Jo1KjTriHWVt8ZSyFi2oU5TVF9HZ33 vUPcLSD1F/JSVxSRAjZ0724pDkJM72y5uRUfLvKhXeIqocdZMvAoEPtJBmuC532qX/rqlihytR5AO Fcec5Ltw==; Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksO-00000007NiU-0UGQ for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 09:49:50 +0000 Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-78ef59a369bso123602285a.2 for ; Fri, 19 Apr 2024 02:49:47 -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=G+OLGyPz2NtLOZH/YOdUHJtasX7vVXp+smN0A8Fakk8=; b=Rke3O+G5FbTzDOFTu7HWY/vgiHtp/cy9sIj6/MEbtkGHNx9tVIAykreAy8GJqQK/21 Pw5dZ0hlpQQvWijgpBc2SBJvWiXyYk/C2Qn+XPvE9keIjDccppVvNSTog3L3gseZYqI3 Iek7qNiFvTLWrKZcBcMlOVjiL56WEKOoVyeUo= 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=G+OLGyPz2NtLOZH/YOdUHJtasX7vVXp+smN0A8Fakk8=; b=qbhJ4jerUOLrqpjb+yfAHXU6DwNs9E638lqGgd+e6whwCB3s7prfWoOLVhG1sJ5doY Yd3T7aWwaI6XBmco91oZLlRL+KVT8U50alxMfhCgLwLRR4U/aFz6fl6d4Tk9ZkuAOepW 8s11uhvos45Hbz8nDy2rwBOqg2CBro5bV1Xezb8+GNtq/JKAK6oUDDWhYynSzr2jJABu 71okEyqL+rFtPFmmBXLS4veCYoF/dPue+RZzKeMsM6T+LWTy7YXBS+W4l39oSJSTXIVm nscOhH/Lszbdb5vlbRhzXNWaupEo7qpFZe58jNn/a9ayX6bQTXNPIgCx8WK/YMbZ5ixm bScw== X-Forwarded-Encrypted: i=1; AJvYcCWNetGEwL4Q50NRiBA+IAjcVrwoYcDgOL0kT676ZLGEre34Ws8b8Sy5hoGLqSI4CF6VgTTit6fMTX2FZ/V1cLz/T/OYILU7N9/CBTyqmkheWQ9jsL8= X-Gm-Message-State: AOJu0Yxzdv6VH+jehQKhDZvGp5pUGaj1rs3s/mg0Y8m57k7/s83I8Uth YqAOLuwanC6jKnNqFp3HUsEbLWbTld9OQrbhPI1tw8W/VlnLYc5qMzzIaRk2LQ== X-Google-Smtp-Source: AGHT+IGmrMUnhFDPACSHoV4O9y/blrNx/1c6IZqAeqIu8A58TfBv2t0AZdePdmIMfSq3rhn78LSShA== X-Received: by 2002:a05:620a:8116:b0:78d:7036:fbda with SMTP id os22-20020a05620a811600b0078d7036fbdamr1727540qkn.75.1713520185768; Fri, 19 Apr 2024 02:49:45 -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:45 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:48:09 +0000 Subject: [PATCH v2 23/26] media: venus: vdec: Make explicit the range of us_per_frame MIME-Version: 1.0 Message-Id: <20240419-fix-cocci-v2-23-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_104948_243895_C5DF0AA8 X-CRM114-Status: GOOD ( 11.59 ) 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. Signed-off-by: Ricardo Ribalda Reviewed-by: Bryan O'Donoghue --- 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;