From patchwork Mon Apr 15 19:34:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13630637 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 A9D3EC00A94 for ; Mon, 15 Apr 2024 19:38:37 +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=B7FijsbPM5g1I1RDThWiZT/T/X092VhSRMCZW7iSRXo=; b=BD3/lGqZj2ShEw 4pATwO1fzqgDoTTLWQGYXvU7rJbNDeVtWzogQV2JkBzJKIBtiPfYJ69e4gVAMpHoKRQVMSwCbBiNg ELw9XRsdw2cntZ/eUhYM1knQauyX4N9yJA7slo5zlN8CPSTQQa/5A0T50RQsDgADYQ1MY38vmeAHJ FgJGdZBe4wCnJ8pj665UExKGZ7ATfbAxYB5scstH+KsbJ616SM/TMdtWWnF3qBb1OlvrIHDOLJZ0W My8t0dDniQg6eew1IiZKVXuEKQ2+Nb+bXwFKuB5/YL6D3iP3N7OXqlnvo1Lg1cqoyjICqqeN4ZxM2 T//HyDQH1xWylYzLSXxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwS9s-00000009eIT-1IJ8; Mon, 15 Apr 2024 19:38:28 +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 1rwS6a-00000009cJU-2T4x for linux-arm-kernel@bombadil.infradead.org; Mon, 15 Apr 2024 19:35:04 +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=ApRUmXHVQV4ipJPLdz2OGTOSZdnvD9pjmVa3NeYIwaE=; b=GSJiL6k0TD+96yN5W7yXPJDoZ2 xf5GcXV7CfHj7FaSDBV0jXE38gpoCnLR8nod1QXUZmPz1dZaAqGZCQgmcO1heHMGLFSTuMx1Vldci xjRgYU9dF1Kpl7gP+BVD0zbQpNAAOCZ8/J8l21gln24hCU2ZidwsATAxArqCYm3s1K5/rUfqmPssB jUiV6L0C8zVdSQLaMJa9wFQF92XqPw759P7rww4EKMZx0woB1oA4pI9rvNy5OSVri0wkMkvIuB1Q/ /YZK2j8gfvUx+ecvbeOBWaWPJMO7/jvD7Okzpnga/tKJjxUX8iVvJE0hZ6ITz+PdvZS63Yv0IidP6 Hax2h6Hw==; Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwS6T-0000000Aijk-2Bzd for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2024 19:35:03 +0000 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3c6f6c5bc37so1583546b6e.1 for ; Mon, 15 Apr 2024 12:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209692; x=1713814492; 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=ApRUmXHVQV4ipJPLdz2OGTOSZdnvD9pjmVa3NeYIwaE=; b=itrtW99D7xQ7IlIF614iSEy5rHEWv+eM1apUpG/C5zErDwcOCOUTX37vPhlKoJG8Ij o3OMeKSWx0ltingBCdmS8/3K1ub/9kJDXkxKR1+qxM5sy2B0dM55Sch0imzHqyDzj1k4 8FRC/En6kxcu6EWWlqbDgh7EvXLPY/JXnJCWE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713209692; x=1713814492; 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=ApRUmXHVQV4ipJPLdz2OGTOSZdnvD9pjmVa3NeYIwaE=; b=bD4j2C5AFMYlzBt50QX6sy5h5R0Gbl9kgxF8nIl+Ij36W3vBpfaqYkxwFDRh2rC9Tp p8J/OGiU86Qu6PuWmURjy15xJHoRt/t7TK3542qruuKXSJkiWIJ3d/KiqokIFF710ssd UrzifISLC62XHLBIsRrCIFC5LJD5bOA861/S7GgK80JSV6/EaQJfWPAUlyb+kTrFKt6U qAqeZJeuI/TEil2+uf7TpTsOfwdHPU9sWDG+AxBd+21L070YoiXEQlMgScWwZMm0Ps+F 9KEHZXc6jAH9YrmLRx+aMzOnjKT5RPqEeyOR6RS5By9rfXgHkp7Z6sWQuaozynep/Vq2 fAjg== X-Forwarded-Encrypted: i=1; AJvYcCUYt4plJLT+Sc2RDOWQI8uSDqpVtacn6OhdlpieFx7MFE2hT2icoLCy7wbjgA5bw24McbNv/mvhmnVuwieEq0uMmp80fePtrlOB97jk9lhx2/AH4qM= X-Gm-Message-State: AOJu0YzwkA2I+e200KjbblHr6pz30XX9mNiWdHt0nscwstitK1rFj+fD v0w3gDEqvxQRTWlhkfVKBBQMGdO/u6GxMF5tQk00o0i8x3QhvJIcdBEA2OFxfQ== X-Google-Smtp-Source: AGHT+IGZ58NMkpObXyXFmK/dlwdDRAXnKMQeVrLnGqtYNcTRA6TD/q28Ror56VZ2t4DiW7soUyKUtg== X-Received: by 2002:a05:6808:128c:b0:3c5:fe95:2371 with SMTP id a12-20020a056808128c00b003c5fe952371mr14036703oiw.29.1713209692296; Mon, 15 Apr 2024 12:34:52 -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 s26-20020ae9f71a000000b0078d3b54eb76sm6718055qkg.78.2024.04.15.12.34.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:34:51 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 15 Apr 2024 19:34:38 +0000 Subject: [PATCH 21/35] media: venus: Use div64_u64 MIME-Version: 1.0 Message-Id: <20240415-fix-cocci-v1-21-477afb23728b@chromium.org> References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> In-Reply-To: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hans Verkuil , 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 , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , Benjamin Mugnier , Sylvain Petinot , Jacopo Mondi , Kieran Bingham , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= , Pavel Machek 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-20240415_203458_764311_2B71225F X-CRM114-Status: GOOD ( 13.21 ) 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 us_per_frame does not fit in 32 bits. Use the appropriate div function. 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 --- 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..1dffeb7de76e 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 = div64_u64(USEC_PER_SEC, us_per_frame); inst->timeperframe = *timeperframe; return 0;