linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Martin Tuma <martin.tuma@digiteqautomotive.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hugues Fruchet <hugues.fruchet@foss.st.com>,
	Alain Volmat <alain.volmat@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Hans Verkuil <hverkuil@xs4all.nl>, Sergey Kozlov <serjk@netup.ru>,
	Abylay Ospan <aospan@netup.ru>,
	Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	Dmitry Osipenko <digetx@gmail.com>,
	Benjamin Mugnier <benjamin.mugnier@foss.st.com>,
	Sylvain Petinot <sylvain.petinot@foss.st.com>,
	Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
	Vikash Garodia <quic_vgarodia@quicinc.com>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	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
Subject: Re: [PATCH v2 21/26] media: i2c: st-mipid02: Use the correct div function
Date: Wed, 24 Apr 2024 18:22:13 +0000	[thread overview]
Message-ID: <ZilN1VBduFcqNBbr@kekkonen.localdomain> (raw)
In-Reply-To: <20240419-fix-cocci-v2-21-2119e692309c@chromium.org>

Hi Ricardo,

On Fri, Apr 19, 2024 at 09:48:07AM +0000, Ricardo Ribalda wrote:
> link_freq does not fit in 32 bits.
> 
> Found by cocci:
> drivers/media/i2c/st-mipid02.c:329:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_s64 instead.
> 
> Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/i2c/st-mipid02.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
> index f250640729ca..93a40bfda1af 100644
> --- a/drivers/media/i2c/st-mipid02.c
> +++ b/drivers/media/i2c/st-mipid02.c
> @@ -326,7 +326,7 @@ static int mipid02_configure_from_rx_speed(struct mipid02_dev *bridge,
>  	}
>  
>  	dev_dbg(&client->dev, "detect link_freq = %lld Hz", link_freq);
> -	do_div(ui_4, link_freq);
> +	ui_4 = div64_s64(ui_4, link_freq);

These are positive numbers and ui_4 is unsigned. I'd use div64_u64()
instead. With that,

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

>  	bridge->r.clk_lane_reg1 |= ui_4 << 2;
>  
>  	return 0;
> 

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2024-04-24 18:22 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  9:47 [PATCH v2 00/26] media: Fix coccinelle warning/errors Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 01/26] media: pci: mgb4: Refactor struct resources Ricardo Ribalda
2024-04-20 23:00   ` Bryan O'Donoghue
2024-04-19  9:47 ` [PATCH v2 02/26] media: stb0899: Simplify check Ricardo Ribalda
2024-04-20 23:07   ` Bryan O'Donoghue
2024-04-19  9:47 ` [PATCH v2 03/26] media: uvcvideo: Refactor iterators Ricardo Ribalda
2024-04-19 10:01   ` Laurent Pinchart
2024-04-19  9:47 ` [PATCH v2 04/26] media: uvcvideo: Use max() macro Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 05/26] media: go7007: Use min and max macros Ricardo Ribalda
2024-04-20 23:11   ` Bryan O'Donoghue
2024-04-19  9:47 ` [PATCH v2 06/26] media: stm32-dcmipp: Remove redundant printk Ricardo Ribalda
2024-04-20 23:15   ` Bryan O'Donoghue
2024-04-22  6:52     ` Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 07/26] media: staging: sun6i-isp: " Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 08/26] media: dvb-frontends: tda18271c2dd: Remove casting during div Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 09/26] media: v4l: async: refactor v4l2_async_create_ancillary_links Ricardo Ribalda
2024-04-20 23:23   ` Bryan O'Donoghue
2024-04-24 10:55   ` Hans Verkuil
2024-04-24 18:17     ` Sakari Ailus
2024-04-24 18:46       ` Laurent Pinchart
2024-04-29 10:51         ` Ricardo Ribalda
2024-05-04  8:25           ` Hans Verkuil
2024-04-19  9:47 ` [PATCH v2 10/26] staging: media: tegra-video: Use swap macro Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 11/26] media: s2255: Use refcount_t instead of atomic_t for num_channels Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 12/26] media: platform: mtk-mdp3: Use refcount_t for job_count Ricardo Ribalda
2024-04-19  9:47 ` [PATCH v2 13/26] media: common: saa7146: Use min macro Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 14/26] media: dvb-frontends: drx39xyj: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 15/26] media: netup_unidvb: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 16/26] media: au0828: " Ricardo Ribalda
2024-04-24 11:03   ` Hans Verkuil
2024-04-19  9:48 ` [PATCH v2 17/26] media: flexcop-usb: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 18/26] media: gspca: cpia1: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 19/26] media: stk1160: " Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 20/26] media: tegra-vde: Refactor timeout handling Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 21/26] media: i2c: st-mipid02: Use the correct div function Ricardo Ribalda
2024-04-24 18:22   ` Sakari Ailus [this message]
2024-04-19  9:48 ` [PATCH v2 22/26] media: tc358746: Use the correct div_ function Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 23/26] media: venus: vdec: Make explicit the range of us_per_frame Ricardo Ribalda
2024-04-20 22:47   ` Bryan O'Donoghue
2024-04-21 13:20   ` Markus Elfring
2024-04-19  9:48 ` [PATCH v2 24/26] media: venus: venc: " Ricardo Ribalda
2024-04-20 22:47   ` Bryan O'Donoghue
2024-04-21 13:25   ` Markus Elfring
2024-04-21 13:48     ` Greg Kroah-Hartman
2024-04-19  9:48 ` [PATCH v2 25/26] media: dvb-frontends: tda10048: Fix integer overflow Ricardo Ribalda
2024-04-19  9:48 ` [PATCH v2 26/26] media: dvb-frontends: tda10048: Make explicit the range of z Ricardo Ribalda
2024-04-21 14:07   ` Markus Elfring
2024-04-24 11:11 ` [PATCH v2 00/26] media: Fix coccinelle warning/errors Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZilN1VBduFcqNBbr@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=alain.volmat@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=aospan@netup.ru \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=digetx@gmail.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=hugues.fruchet@foss.st.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=martin.tuma@digiteqautomotive.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=ribalda@chromium.org \
    --cc=samuel@sholland.org \
    --cc=serjk@netup.ru \
    --cc=skomatineni@nvidia.com \
    --cc=stanimir.k.varbanov@gmail.com \
    --cc=sylvain.petinot@foss.st.com \
    --cc=thierry.reding@gmail.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).