Skip to contentSkip to conversation

ubi: fix sparse errors in ubi.h

PATCH In review Harvey Harrison 4 participants 4 messages Feb 14, 2008 – Feb 15, 2008

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

PATCH 1/1 ubi: fix sparse errors in ubi.h

In C, signed 1-bit bitfields can only take the values 0 and -1, only 0 and 1 are ever assigned in current code. Make them unsigned bitfields.

Fixes the (repeated) sparse errors:
drivers/mtd/ubi/ubi.h:220:15: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:221:17: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:222:18: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:223:16: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:224:20: error: dubious one-bit signed bitfield

---
Sorry, not sure who to CC on this.

 drivers/mtd/ubi/ubi.h |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/mtd/ubi/ubi.h +5 -5
index 4577106..a548c1d 100644
@@ -217,11 +217,11 @@ struct ubi_volume {
 	void *upd_buf;
 
 	int *eba_tbl;
-	int checked:1;
-	int corrupted:1;
-	int upd_marker:1;
-	int updating:1;
-	int changing_leb:1;
+	unsigned int checked:1;
+	unsigned int corrupted:1;
+	unsigned int upd_marker:1;
+	unsigned int updating:1;
+	unsigned int changing_leb:1;
 
 #ifdef CONFIG_MTD_UBI_GLUEBI
 	/*
Signature · 1 line
1.5.4.1.1278.gc75be
#1 lore raw
Quoted 11 lines · Harvey Harrison

In C, signed 1-bit bitfields can only take the values 0 and -1, only 0 and 1 are ever assigned in current code. Make them unsigned bitfields.

Fixes the (repeated) sparse errors:
drivers/mtd/ubi/ubi.h:220:15: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:221:17: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:222:18: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:223:16: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:224:20: error: dubious one-bit signed bitfield

Quoted 3 lines

---
Sorry, not sure who to CC on this.

IIRC: Artem Bityutskiy <[email protected]>

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#3 lore raw
In reply to Harvey Harrison
Quoted 11 lines · Harvey Harrison

In C, signed 1-bit bitfields can only take the values 0 and -1, only 0 and 1 are ever assigned in current code. Make them unsigned bitfields.

Fixes the (repeated) sparse errors:
drivers/mtd/ubi/ubi.h:220:15: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:221:17: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:222:18: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:223:16: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:224:20: error: dubious one-bit signed bitfield

Quoted 4 lines

---
Sorry, not sure who to CC on this.
...

$ grep UBI MAINTAINERS 
UNSORTED BLOCK IMAGES (UBI)
$ 

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#2 lore raw
In reply to Ben Dooks
Quoted 12 lines · Ben Dooks
Quoted 11 lines · Harvey Harrison

In C, signed 1-bit bitfields can only take the values 0 and -1, only 0 and 1 are ever assigned in current code. Make them unsigned bitfields.

Fixes the (repeated) sparse errors:
drivers/mtd/ubi/ubi.h:220:15: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:221:17: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:222:18: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:223:16: error: dubious one-bit signed bitfield drivers/mtd/ubi/ubi.h:224:20: error: dubious one-bit signed bitfield

Quoted 5 lines
Quoted 3 lines

---
Sorry, not sure who to CC on this.

IIRC: Artem Bityutskiy <[email protected]>

UNSORTED BLOCK IMAGES (UBI)

P:      Artem Bityutskiy
M:      [email protected]
W:      http://www.linux-mtd.infradead.org/
L:      [email protected]
T:      git git://git.infradead.org/~dedekind/ubi-2.6.git
S:      Maintained
F:      drivers/mtd/ubi
F:      include/linux/mtd/ubi.h
F:      include/mtd/ubi-*