Linux-Media Archive mirror
 help / color / mirror / Atom feed
From: Dragan Simic <dsimic@manjaro.org>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Martin Tuma <martin.tuma@digiteqautomotive.com>,
	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>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	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 v3 26/26] media: dvb-frontends: tda10048: Make the range of z explicit.
Date: Fri, 03 May 2024 16:08:48 +0200	[thread overview]
Message-ID: <fe95e3c3a89de4566a4eb53ca8b26c25@manjaro.org> (raw)
In-Reply-To: <CANiDSCsU+jgYkUmHZOC8xPsL2DbgU7_sWrby1bQAXQNnp+g6Bg@mail.gmail.com>

Hello Ricardo,

On 2024-05-03 13:56, Ricardo Ribalda wrote:
> I am trying to get the DS, but
> https://www.nxp.com/acrobat_download/literature/9397/75015931.pdf is a
> dead links now.
> 
> Anyone have access to the datasheet?

It's kind of available on the link below, but for some strange reason
the download fails after downloading the first 128 KB or so.

https://web.archive.org/web/20080907185532/https://www.nxp.com/acrobat_download/literature/9397/75015931.pdf


> On Fri, 3 May 2024 at 13:55, Dan Carpenter <dan.carpenter@linaro.org> 
> wrote:
>> 
>> On Fri, May 03, 2024 at 11:27:58AM +0100, Mauro Carvalho Chehab wrote:
>> > Em Mon, 29 Apr 2024 15:05:05 +0000
>> > Ricardo Ribalda <ribalda@chromium.org> escreveu:
>> >
>> > > We do not expect the sample_freq to be over 613MHz.
>> > >
>> > > Found by cocci:
>> > > drivers/media/dvb-frontends/tda10048.c:345:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
>> > >
>> > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
>> > > ---
>> > >  drivers/media/dvb-frontends/tda10048.c | 4 +++-
>> > >  1 file changed, 3 insertions(+), 1 deletion(-)
>> > >
>> > > diff --git a/drivers/media/dvb-frontends/tda10048.c b/drivers/media/dvb-frontends/tda10048.c
>> > > index 3e725cdcc66b..1886f733dbbf 100644
>> > > --- a/drivers/media/dvb-frontends/tda10048.c
>> > > +++ b/drivers/media/dvb-frontends/tda10048.c
>> > > @@ -328,7 +328,8 @@ static int tda10048_set_wref(struct dvb_frontend *fe, u32 sample_freq_hz,
>> > >                          u32 bw)
>> > >  {
>> > >     struct tda10048_state *state = fe->demodulator_priv;
>> > > -   u64 t, z;
>> > > +   u32 z;
>> > > +   u64 t;
>> > >
>> > >     dprintk(1, "%s()\n", __func__);
>> > >
>> > > @@ -341,6 +342,7 @@ static int tda10048_set_wref(struct dvb_frontend *fe, u32 sample_freq_hz,
>> > >     /* t *= 2147483648 on 32bit platforms */
>> > >     t *= (2048 * 1024);
>> > >     t *= 1024;
>> > > +   /* Sample frequency is under 613MHz */
>> >
>> > Are you sure about that? Some DVB devices have very high frequency
>> > clocks, specially if they're also used for satellite, so I can't
>> > be sure by just looking at the driver's code.
>> >
>> > Also, we had already a bunch of regressions with "fixes" like this
>> > that actually broke frontend drivers.
>> 
>> This patch preserves the existing behavior. The sample_freq_hz 
>> variable
>> is a u32 so, in the original code, z couldn't have been more than
>> U32_MAX even though it was declared as a u64.
>> 
>> It's possible that the original code was wrong.  We have seen that in
>> other places in this patchset.  Adding a note about the datasheet is
>> also a good idea.
>> 
>> regards,
>> dan carpenter
>> 

  reply	other threads:[~2024-05-03 14:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29 15:04 [PATCH v3 00/26] media: Fix coccinelle warning/errors Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 01/26] media: pci: mgb4: Refactor struct resources Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 02/26] media: stb0899: Simplify check Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 03/26] media: uvcvideo: Refactor iterators Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 04/26] media: uvcvideo: Use max() macro Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 05/26] media: go7007: Use min and max macros Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 06/26] media: stm32-dcmipp: Remove redundant printk Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 07/26] media: staging: sun6i-isp: " Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 08/26] media: dvb-frontends: tda18271c2dd: Remove casting during div Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 09/26] media: v4l: async: refactor v4l2_async_create_ancillary_links Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 10/26] staging: media: tegra-video: Use swap macro Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 11/26] media: s2255: Use refcount_t instead of atomic_t for num_channels Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 12/26] media: platform: mtk-mdp3: Use refcount_t for job_count Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 13/26] media: common: saa7146: Use min macro Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 14/26] media: dvb-frontends: drx39xyj: " Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 15/26] media: netup_unidvb: " Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 16/26] media: au0828: Use umin macro Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 17/26] media: flexcop-usb: Use min macro Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 18/26] media: gspca: cpia1: " Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 19/26] media: stk1160: " Ricardo Ribalda
2024-04-29 15:04 ` [PATCH v3 20/26] media: tegra-vde: Refactor timeout handling Ricardo Ribalda
2024-04-29 15:05 ` [PATCH v3 21/26] media: i2c: st-mipid02: Use the correct div function Ricardo Ribalda
2024-04-29 15:05 ` [PATCH v3 22/26] media: tc358746: Use the correct div_ function Ricardo Ribalda
2024-04-29 15:05 ` [PATCH v3 23/26] media: venus: vdec: Make the range of us_per_frame explicit Ricardo Ribalda
2024-04-29 15:05 ` [PATCH v3 24/26] media: venus: venc: " Ricardo Ribalda
2024-04-29 15:05 ` [PATCH v3 25/26] media: dvb-frontends: tda10048: Fix integer overflow Ricardo Ribalda
2024-04-29 15:05 ` [PATCH v3 26/26] media: dvb-frontends: tda10048: Make the range of z explicit Ricardo Ribalda
2024-05-03 10:27   ` Mauro Carvalho Chehab
2024-05-03 11:55     ` Dan Carpenter
2024-05-03 11:56       ` Ricardo Ribalda
2024-05-03 14:08         ` Dragan Simic [this message]
2024-05-13 13:35           ` Ricardo Ribalda
2024-05-13 14:25             ` Michael Ira Krufky

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=fe95e3c3a89de4566a4eb53ca8b26c25@manjaro.org \
    --to=dsimic@manjaro.org \
    --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=dan.carpenter@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=sakari.ailus@linux.intel.com \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).