All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: yanguoxiong@huawei.com
Cc: linux-media@vger.kernel.org
Subject: re: [media] rc: Introduce hix5hd2 IR transmitter driver
Date: Wed, 24 Sep 2014 17:26:26 +0300	[thread overview]
Message-ID: <20140924142626.GA25631@mwanda> (raw)

Hello Guoxiong Yan,

The patch a84fcdaa9058: "[media] rc: Introduce hix5hd2 IR transmitter
driver" from Aug 30, 2014, leads to the following static checker
warning:

	drivers/media/rc/ir-hix5hd2.c:111 hix5hd2_ir_config()
	warn: odd binop '0x3e80 & 0xffff0000'

drivers/media/rc/ir-hix5hd2.c
   109          /* Now only support raw mode, with symbol start from low to high */
   110          rate = DIV_ROUND_CLOSEST(priv->rate, 1000000);
   111          val = IR_CFG_SYMBOL_MAXWIDTH & IR_CFG_WIDTH_MASK << IR_CFG_WIDTH_SHIFT;
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   112          val |= IR_CFG_SYMBOL_FMT & IR_CFG_FORMAT_MASK << IR_CFG_FORMAT_SHIFT;
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

These seem like precedence bugs.  My guess is that the intent was:

		val =  (IR_CFG_SYMBOL_MAXWIDTH & IR_CFG_WIDTH_MASK) << IR_CFG_WIDTH_SHIFT;
		val |= (IR_CFG_SYMBOL_FMT & IR_CFG_FORMAT_MASK) << IR_CFG_FORMAT_SHIFT;

etc for the rest as well.

   113          val |= (IR_CFG_INT_THRESHOLD - 1) & IR_CFG_INT_LEVEL_MASK
   114                 << IR_CFG_INT_LEVEL_SHIFT;
   115          val |= IR_CFG_MODE_RAW;
   116          val |= (rate - 1) & IR_CFG_FREQ_MASK << IR_CFG_FREQ_SHIFT;
   117          writel_relaxed(val, priv->base + IR_CONFIG);

regards,
dan carpenter

                 reply	other threads:[~2014-09-24 14:26 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=20140924142626.GA25631@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-media@vger.kernel.org \
    --cc=yanguoxiong@huawei.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.