From: Dan Carpenter <dan.carpenter@oracle.com>
To: crope@iki.fi
Cc: linux-media@vger.kernel.org
Subject: re: rtl2832_sdr: move from staging to media
Date: Wed, 13 May 2015 14:11:27 +0300 [thread overview]
Message-ID: <20150513111127.GA29021@mwanda> (raw)
Hello Antti Palosaari,
The patch 77bbb2b049c1: "rtl2832_sdr: move from staging to media"
from Jul 15, 2014, leads to the following static checker warning:
drivers/media/dvb-frontends/rtl2832_sdr.c:1265 rtl2832_sdr_s_ctrl()
warn: test_bit() bitwise op in bit number
This is harmless but messy.
drivers/media/dvb-frontends/rtl2832_sdr.c
109
110 struct rtl2832_sdr_dev {
111 #define POWER_ON (1 << 1)
112 #define URB_BUF (1 << 2)
We were supposed to use these to set ->flags on the next line.
113 unsigned long flags;
114
115 struct platform_device *pdev;
116
117 struct video_device vdev;
118 struct v4l2_device v4l2_dev;
119
[ snip ]
389 dev_dbg(&pdev->dev, "alloc buf=%d %p (dma %llu)\n",
390 dev->buf_num, dev->buf_list[dev->buf_num],
391 (long long)dev->dma_addr[dev->buf_num]);
392 dev->flags |= USB_STATE_URB_BUF;
^^^^^^^^^^^^^^^^^
But we use USB_STATE_URB_BUF (0x1) instead of URB_BUF.
393 }
[ snip ]
1263 c->bandwidth_hz = dev->bandwidth->val;
1264
1265 if (!test_bit(POWER_ON, &dev->flags))
^^^^^^^^
The original intent of the code was we test "if (dev->flags & POWER_ON)"
but really what this is doing is "if (dev->flags & (1 << POWER_ON))"
which is fine because we do it consistently, but it's not pretty and it
causes static checkers to complain (and rightfully so).
1266 return 0;
1267
1268 if (fe->ops.tuner_ops.set_params)
1269 ret = fe->ops.tuner_ops.set_params(fe);
1270 else
1271 ret = 0;
1272 break;
1273 default:
regards,
dan carpenter
next reply other threads:[~2015-05-13 11:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 11:11 Dan Carpenter [this message]
2015-05-13 15:00 ` rtl2832_sdr: move from staging to media Antti Palosaari
2015-05-14 8:39 ` [patch] [media] rtl2832_sdr: cleanup some set_bit() calls 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=20150513111127.GA29021@mwanda \
--to=dan.carpenter@oracle.com \
--cc=crope@iki.fi \
--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