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: 789084 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (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 23FFE15F41D for ; Mon, 15 Apr 2024 19:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209697; cv=none; b=EK05i/lyRuEd7BGBLJCmrfnUgb/gW6z9egGkUdWZO2QDEkHAGASU6etKBMxMTaOsZwnR5r7niIF7sUyJYtc1Cm1sczVoZFlZy67grk2qo8IH6oxoYLRDi1RV7wqqrNgzbSRakH2iFNbLlwvlzGdSqs26d+ZyA+sIrazYq4c7Ny8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209697; c=relaxed/simple; bh=3+1Bl8mh/8+eBa7Eij9anNi89S/ycWDT7MhZBO0qMzU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GrdB8FRJzK6PcAsIm19cd+uezzvZO1b0uY0RVRk/n/fM/YYc5HBL8Kt2fSFcHmrRNf5KhSb/Ofbn8zp+Ny5XhRqwe6Lxq+ZKg/NywvQAKE9anXCPp4QHuqb/z7pfnksNViE60H2A+J6H1nS+hdkQY+ycVVc486ep0KU8uni8+yQ= 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=lIyai6wr; arc=none smtp.client-ip=209.85.167.178 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="lIyai6wr" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3c6f6c5bc37so1583542b6e.1 for ; Mon, 15 Apr 2024 12:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209692; x=1713814492; 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=ApRUmXHVQV4ipJPLdz2OGTOSZdnvD9pjmVa3NeYIwaE=; b=lIyai6wrhkTq1KgJXWND6e7iZcGU3W5PDuicQ9o3kOu9cam4Q//AywMviobqx66UJW FY9tN8SVI1UeRsOuMQM2+tJVjWi8wjNJ3LW6NqTuUjqZ45YuMa7pgDv5WAkj1QTS2JYE KKskNvykMkRm58jLJoC6w9FB3YaP2y6n8ugSo= 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=NFyRlhTf9KfyPS3SkFyoLTt35mls4um1zTo7sieeLzIfPaU3XWqvCG2etUa4acNF3W yBxqD+BYD0cTJ8TQ0G61k2+TwanHtEb5NnEcyhe9y3bA5LF/hmDXM797IWJFs2edvWOb goFn89oHAC4llhZ9d5VyCuAYGPYPVz65YwAmRhz7geEnM6GYknbc5H7vMp83ZPhogpCg M5g6X0SMyWAcCJBlHk/HOYX3t+XU/2ccM18x8CAbSQgAQKVdoz04iQWxYFQ0IJPJkAJ1 kpaOj0ikXQdUlNpNvrhA8wo0skPGUzBVRHb1V4nsy6BgNz591Q9J6yATG7UNkvGWabKf eEzA== X-Gm-Message-State: AOJu0YzqtWh1d59anadriAiQ4eCQwfbMhhq7ZmZFEm+eBFO03O6YMbgh pD9Vj/LN66jnn/7vSSAkeB2GlXPi3pkrdZTXv+8x2CiLuiH2w1hgVdrv2RE4JQ== 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 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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;