All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: michael.hennerich@analog.com
Cc: linux-iio@vger.kernel.org
Subject: re: iio: frequency: New driver for Analog Devices ADF4350/ADF4351 Wideband Synthesizers
Date: Wed, 22 May 2013 23:25:31 +0300	[thread overview]
Message-ID: <20130522202531.GA1438@elgon.mountain> (raw)

Hello Michael Hennerich,

The patch e31166f0fd48: "iio: frequency: New driver for Analog
Devices ADF4350/ADF4351 Wideband Synthesizers" from May 29, 2012,
leads to the following warning:
"drivers/iio/frequency/adf4350.c:212 adf4350_set_freq()
	 warn: 0x13c001fc0 is larger than 32 bits"

I have been messing with Smatch recently and this is not the right
warning...  :/

drivers/iio/frequency/adf4350.c
   207          st->regs[ADF4350_REG2] =
   208                  ADF4350_REG2_10BIT_R_CNT(r_cnt) |
   209                  ADF4350_REG2_DOUBLE_BUFF_EN |
   210                  (pdata->ref_doubler_en ? ADF4350_REG2_RMULT2_EN : 0) |
   211                  (pdata->ref_div2_en ? ADF4350_REG2_RDIV2_EN : 0) |
   212                  (pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS |
   213                  ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N |
   214                  ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) |
   215                  ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x9)));
                        ^^^^^^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
0x7 and 0x9 are signed int so when we do "<< 29" it wraps or has a sign
extention.  Also we are doing a bitwise AND with 32 bit unsigned values
so they get truncated that way too.

It's not clear what was intended here.

regards,
dan carpenter


             reply	other threads:[~2013-05-22 20:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22 20:25 Dan Carpenter [this message]
2013-05-23  8:23 ` iio: frequency: New driver for Analog Devices ADF4350/ADF4351 Wideband Synthesizers Michael Hennerich
2013-05-23  9:15   ` Dan Carpenter

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=20130522202531.GA1438@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.