Skip to contentSkip to conversation

go7007: dubious one-bit signed bitfields

PATCH In review Dan Carpenter 2 participants 2 messages Apr 17, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 go7007: dubious one-bit signed bitfields

Because they're signed, "is_video" and "is_audio" can be 0 and -1
instead of 0 and 1 as intended. It doesn't cause a bug, but it makes Sparse complain:
drivers/staging/media/go7007/go7007-priv.h:94:31: error: dubious one-bit signed bitfield drivers/staging/media/go7007/go7007-priv.h:95:31: error: dubious one-bit signed bitfield

drivers/staging/media/go7007/go7007-priv.h +2 -2
index 8bde187..6e16af7 100644
@@ -91,8 +91,8 @@ struct go7007_board_info {
 	int num_i2c_devs;
 	struct go_i2c {
 		const char *type;
-		int is_video:1;
-		int is_audio:1;
+		unsigned int is_video:1;
+		unsigned int is_audio:1;
 		int addr;
 		u32 flags;
 	} i2c_devs[5];
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Wed 17 April 2013 09:20:30 Dan Carpenter wrote:

Because they're signed, "is_video" and "is_audio" can be 0 and -1
instead of 0 and 1 as intended. It doesn't cause a bug, but it makes Sparse complain:
drivers/staging/media/go7007/go7007-priv.h:94:31: error: dubious one-bit signed bitfield drivers/staging/media/go7007/go7007-priv.h:95:31: error: dubious one-bit signed bitfield

Thanks!

Hans

Quoted 21 lines
drivers/staging/media/go7007/go7007-priv.h +2 -3
index 8bde187..6e16af7 100644
@@ -91,8 +91,8 @@ struct go7007_board_info {
 	int num_i2c_devs;
 	struct go_i2c {
 		const char *type;
-		int is_video:1;
-		int is_audio:1;
+		unsigned int is_video:1;
+		unsigned int is_audio:1;
 		int addr;
 		u32 flags;
 	} i2c_devs[5];
--

To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html