Skip to contentSkip to conversation

logical-bitwise & confusion in se401_init()?

PATCH In review Mauro Carvalho Chehab 3 participants 4 messages Mar 13, 2008 1 message not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines · On Mon, 10 Mar 2008 00:27:19 +0100 Roel Kluin <[email protected]> wrote:

drivers/media/video/se401.c:1282:

if (!cp[2] && SE401_FORMAT_BAYER) {

shouldn't this be 'if (!(cp[2] & SE401_FORMAT_BAYER)) {' drivers/media/video/se401.h:52:

#define SE401_FORMAT_BAYER 0x40

I don't have this driver, but this seems to be the proper fix.

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#2 lore raw

PATCH 1/1 logical-bitwise & confusion in se401_init() (was: logical-bitwise & confusion in se401_init()?)

Quoted 5 lines · Mauro Carvalho Chehab
Quoted 2 lines · On Mon, 10 Mar 2008 00:27:19 +0100 Roel Kluin <[email protected]> wrote:

drivers/media/video/se401.c:1282:

Quoted 8 lines
Quoted 6 lines

if (!cp[2] && SE401_FORMAT_BAYER) {

shouldn't this be 'if (!(cp[2] & SE401_FORMAT_BAYER)) {' drivers/media/video/se401.h:52:

#define SE401_FORMAT_BAYER 0x40

I don't have this driver, but this seems to be the proper fix.

---
logical-bitwise & confusion, SE401_FORMAT_BAYER is defined 0x40

---

drivers/media/video/se401.c +1 -1
index d5d7d6c..952c9bd 100644
@@ -1279,7 +1279,7 @@ static int se401_init(struct usb_se401 *se401, int button)
 	rc=se401_sndctrl(0, se401, SE401_REQ_GET_HEIGHT, 0, cp, sizeof(cp));
 	se401->cheight=cp[0]+cp[1]*256;
 
-	if (!cp[2] && SE401_FORMAT_BAYER) {
+	if (!cp[2] & SE401_FORMAT_BAYER) {
 		err("Bayer format not supported!");
 		return 1;
 	}
#3 lore raw

Re: [PATCH] logical-bitwise & confusion in se401_init() (was: logical-bitwise & confusion in se401_init()?)

drivers/media/video/se401.c static int se401_init(struct usb_se401 *se401, int button) · line 1285

Quoted 5 lines · On Thu, 13 Mar 2008 16:51:29 +0100 Roel Kluin <[email protected]> wrote:
drivers/media/video/se401.c +1 -1
-	if (!cp[2] && SE401_FORMAT_BAYER) {
+	if (!cp[2] & SE401_FORMAT_BAYER) {
 		err("Bayer format not supported!");
 		return 1;
 	}

Would it be better to put in some additional parenthesis?

	if (!(cp[2] & SE401_FORMAT_BAYER)) {
Signature · 1 line
All Rights Reversed
#4 lore raw

Re: [PATCH] logical-bitwise & confusion in se401_init()

Quoted 11 lines · Rik van Riel

Review

Quoted 5 lines · On Thu, 13 Mar 2008 16:51:29 +0100 Roel Kluin <[email protected]> wrote:
(quoted diff) +1 -1
-	if (!cp[2] && SE401_FORMAT_BAYER) {
+	if (!cp[2] & SE401_FORMAT_BAYER) {
 		err("Bayer format not supported!");
 		return 1;
 	}

Would it be better to put in some additional parenthesis?

Quoted 2 lines
	if (!(cp[2] & SE401_FORMAT_BAYER)) {

yes of course, thanks for catching that.
---
logical-bitwise & confusion

---

drivers/media/video/se401.c +1 -1
index d5d7d6c..9e8b521 100644
@@ -1279,7 +1279,7 @@ static int se401_init(struct usb_se401 *se401, int button)
 	rc=se401_sndctrl(0, se401, SE401_REQ_GET_HEIGHT, 0, cp, sizeof(cp));
 	se401->cheight=cp[0]+cp[1]*256;
 
-	if (!cp[2] && SE401_FORMAT_BAYER) {
+	if (!(cp[2] & SE401_FORMAT_BAYER)) {
 		err("Bayer format not supported!");
 		return 1;
 	}