public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: hans.verkuil@cisco.com
Cc: linux-media@vger.kernel.org
Subject: re: [media] tw9910: init priv->scale and update standard
Date: Thu, 24 Mar 2016 21:37:05 +0300	[thread overview]
Message-ID: <20160324183705.GA9858@mwanda> (raw)

Hello Hans Verkuil,

The patch 1f3375e0b257: "[media] tw9910: init priv->scale and update
standard" from Jun 15, 2015, leads to the following static checker
warning:

	drivers/media/i2c/soc_camera/tw9910.c:536 tw9910_s_std()
	warn: odd binop '0x0 & 0xc'

drivers/media/i2c/soc_camera/tw9910.c
   509  static int tw9910_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
   510  {
   511          struct i2c_client *client = v4l2_get_subdevdata(sd);
   512          struct tw9910_priv *priv = to_tw9910(client);
   513          const unsigned hact = 720;
   514          const unsigned hdelay = 15;
                               ^^^^^^^^^^^
   515          unsigned vact;
   516          unsigned vdelay;
   517          int ret;
   518  
   519          if (!(norm & (V4L2_STD_NTSC | V4L2_STD_PAL)))
   520                  return -EINVAL;
   521  
   522          priv->norm = norm;
   523          if (norm & V4L2_STD_525_60) {
   524                  vact = 240;
   525                  vdelay = 18;
   526                  ret = tw9910_mask_set(client, VVBI, 0x10, 0x10);
   527          } else {
   528                  vact = 288;
   529                  vdelay = 24;
   530                  ret = tw9910_mask_set(client, VVBI, 0x10, 0x00);
   531          }
   532          if (!ret)
   533                  ret = i2c_smbus_write_byte_data(client, CROP_HI,
   534                          ((vdelay >> 2) & 0xc0) |
   535                          ((vact >> 4) & 0x30) |
   536                          ((hdelay >> 6) & 0x0c) |

15 >> 6 is zero.  It's not clear what was intended or why I'm only
seeing this warning now.

   537                          ((hact >> 8) & 0x03));
   538          if (!ret)
   539                  ret = i2c_smbus_write_byte_data(client, VDELAY_LO,
   540                          vdelay & 0xff);
   541          if (!ret)
   542                  ret = i2c_smbus_write_byte_data(client, VACTIVE_LO,
   543                          vact & 0xff);
   544  
   545          return ret;
   546  }

regards,
dan carpenter

                 reply	other threads:[~2016-03-24 18:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160324183705.GA9858@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.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