Skip to contentSkip to conversation

GCC4.6: Squash warning in nand_bbt.c

PATCH Superseded Marek Vasut 4 participants 16 messages Sep 30, 2011 – Oct 3, 2011

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

PATCH 1/5 GCC4.6: Squash warning in nand_bbt.c

nand_bbt.c: In function ?search_bbt?:
nand_bbt.c:465:6: warning: variable ?bits? set but not used [-Wunused-but-set-variable]

---
 drivers/mtd/nand/nand_bbt.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/mtd/nand/nand_bbt.c +1 -4
index 521ddde..ded652b 100644
@@ -462,7 +462,7 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
 {
 	struct nand_chip *this = mtd->priv;
 	int i, chips;
-	int bits, startblock, block, dir;
+	int startblock, block, dir;
 	int scanlen = mtd->writesize + mtd->oobsize;
 	int bbtblocks;
 	int blocktopage = this->bbt_erase_shift - this->page_shift;
@@ -486,9 +486,6 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
 		bbtblocks = mtd->size >> this->bbt_erase_shift;
 	}
 
-	/* Number of bits for each erase block in the bbt */
-	bits = td->options & NAND_BBT_NRBITS_MSK;
-
 	for (i = 0; i < chips; i++) {
 		/* Reset version information */
 		td->version[i] = 0;
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 2/5 GCC4,6: Squash warning in cmd_nand.c

cmd_nand.c: In function ?do_nand?:
cmd_nand.c:490:7: warning: variable ?chip? set but not used [-Wunused-but-set-variable]
cmd_nand.c:489:7: warning: variable ?part? set but not used [-Wunused-but-set-variable]

---
 common/cmd_nand.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
common/cmd_nand.c +0 -4
index f42ea5b..3e12a36 100644
@@ -486,8 +486,6 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 		int scrub_yes = argc > 2 && !strcmp("-y", argv[2]);
 		int o = (clean || scrub_yes) ? 3 : 2;
 		int scrub = !strncmp(cmd, "scrub", 5);
-		int part = 0;
-		int chip = 0;
 		int spread = 0;
 		int args = 2;
 		const char *scrub_warn =
@@ -505,10 +503,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 			if (!strcmp(&cmd[5], ".spread")) {
 				spread = 1;
 			} else if (!strcmp(&cmd[5], ".part")) {
-				part = 1;
 				args = 1;
 			} else if (!strcmp(&cmd[5], ".chip")) {
-				chip = 1;
 				args = 0;
 			} else {
 				goto usage;
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/5 GCC4,6: Squash warning in cmd_nand.c

Quoted 6 lines · Marek Vasut

cmd_nand.c: In function ?do_nand?:
cmd_nand.c:490:7: warning: variable ?chip? set but not used [-Wunused-but-set-variable]
cmd_nand.c:489:7: warning: variable ?part? set but not used [-Wunused-but-set-variable]

Quoted 6 lines
---
 common/cmd_nand.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

This even looks like .part and .chip has no effect at all ... am I right ?

#3 lore raw

PATCH 2/5 GCC4,6: Squash warning in cmd_nand.c

Quoted 7 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

cmd_nand.c: In function ?do_nand?:
cmd_nand.c:490:7: warning: variable ?chip? set but not used [-Wunused-but-set-variable]
cmd_nand.c:489:7: warning: variable ?part? set but not used [-Wunused-but-set-variable]

Quoted 8 lines
Quoted 6 lines
---
 common/cmd_nand.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

This even looks like .part and .chip has no effect at all ... am I right ?

They affect error checking. Beyond that, the code can tell what to do from the number of arguments. The idea was that accidentally leaving out an argument (such as by a misspelled $varaible) shouldn't end up erasing more than you expected.

-Scott

#5 lore raw

PATCH 2/5 GCC4,6: Squash warning in cmd_nand.c

In reply to Marek Vasut

Dear Marek Vasut,

Quoted 11 lines · In message <[email protected]> you wrote:

cmd_nand.c: In function `do_nand?:
cmd_nand.c:490:7: warning: variable `chip? set but not used [-Wunused-but-set-variable]
cmd_nand.c:489:7: warning: variable `part? set but not used [-Wunused-but-set-variable]

---
 common/cmd_nand.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There is an order of things in this universe.
	-- Apollo, "Who Mourns for Adonais?" stardate 3468.1
#6 lore raw

PATCH 3/5 GCC4.6: Squash warning in vmt.c

In reply to Marek Vasut

vmt.c: In function ?ubi_free_volume?:
vmt.c:681:6: warning: variable ?err? set but not used [-Wunused-but-set-variable]

---
 drivers/mtd/ubi/vmt.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/mtd/ubi/vmt.c +1 -3
index 061da64..ce9fec7 100644
@@ -678,12 +678,10 @@ out_cdev:
  */
 void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
 {
-	int err;
-
 	dbg_msg("free volume %d", vol->vol_id);
 
 	ubi->volumes[vol->vol_id] = NULL;
-	err = ubi_destroy_gluebi(vol);
+	ubi_destroy_gluebi(vol);
 	cdev_del(&vol->cdev);
 	volume_sysfs_close(vol);
 }
Signature · 1 line
1.7.5.4
#7 lore raw

PATCH v2 3/5 GCC4.6: Squash warning in vmt.c

vmt.c: In function ?ubi_free_volume?:
vmt.c:681:6: warning: variable ?err? set but not used [-Wunused-but-set-variable]

---
 drivers/mtd/ubi/ubi.h |    7 ++++++-
 drivers/mtd/ubi/vmt.c |    4 +---
 2 files changed, 7 insertions(+), 4 deletions(-)

V2: Convert ubi_destroy_gluebi() to inline fn

drivers/mtd/ubi/ubi.h +6 -1
index bf77a15..14c3a5f 100644
@@ -467,7 +467,12 @@ int ubi_destroy_gluebi(struct ubi_volume *vol);
 void ubi_gluebi_updated(struct ubi_volume *vol);
 #else
 #define ubi_create_gluebi(ubi, vol) 0
-#define ubi_destroy_gluebi(vol) 0
+
+static inline int ubi_destroy_gluebi(struct ubi_volume *vol)
+{
+	return 0;
+}
+
 #define ubi_gluebi_updated(vol)
 #endif
 
drivers/mtd/ubi/vmt.c +1 -3
index 061da64..ce9fec7 100644
@@ -678,12 +678,10 @@ out_cdev:
  */
 void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
 {
-	int err;
-
 	dbg_msg("free volume %d", vol->vol_id);
 
 	ubi->volumes[vol->vol_id] = NULL;
-	err = ubi_destroy_gluebi(vol);
+	ubi_destroy_gluebi(vol);
 	cdev_del(&vol->cdev);
 	volume_sysfs_close(vol);
 }
Signature · 1 line
1.7.5.4
#10 lore raw

PATCH 4/5 GCC4.6: Squash warning in cmd_ubi.c:

In reply to Marek Vasut

cmd_ubi.c: In function ?ubi_volume_read?:
cmd_ubi.c:319:9: warning: variable ?count_save? set but not used [-Wunused-but-set-variable]

---
 common/cmd_ubi.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
common/cmd_ubi.c +1 -2
index 629758f..8c1bc23 100644
@@ -316,7 +316,6 @@ static int ubi_volume_write(char *volume, void *buf, size_t size)
 static int ubi_volume_read(char *volume, char *buf, size_t size)
 {
 	int err, lnum, off, len, tbuf_size;
-	size_t count_save = size;
 	void *tbuf;
 	unsigned long long tmp;
 	struct ubi_volume *vol;
@@ -347,7 +346,7 @@ static int ubi_volume_read(char *volume, char *buf, size_t size)
 	if (vol->corrupted)
 		printf("read from corrupted volume %d", vol->vol_id);
 	if (offp + size > vol->used_bytes)
-		count_save = size = vol->used_bytes - offp;
+		size = vol->used_bytes - offp;
 
 	tbuf_size = vol->usable_leb_size;
 	if (size < tbuf_size)
Signature · 1 line
1.7.5.4
#12 lore raw

PATCH 5/5 GCC4.6: Squash warning in lzo1x_decompress.c

In reply to Marek Vasut

lzo1x_decompress.c: In function ?parse_header?:
lzo1x_decompress.c:35:5: warning: variable ?level? set but not used [-Wunused-but-set-variable]

---
 lib/lzo/lzo1x_decompress.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
lib/lzo/lzo1x_decompress.c +1 -2
index 09bdc8f..e6ff708 100644
@@ -32,7 +32,6 @@ static const unsigned char lzop_magic[] = {
 
 static inline const unsigned char *parse_header(const unsigned char *src)
 {
-	u8 level = 0;
 	u16 version;
 	int i;
 
@@ -47,7 +46,7 @@ static inline const unsigned char *parse_header(const unsigned char *src)
 	version = get_unaligned_be16(src);
 	src += 7;
 	if (version >= 0x0940)
-		level = *src++;
+		src++;
 	if (get_unaligned_be32(src) & HEADER_HAS_FILTER)
 		src += 4; /* filter info */
 
Signature · 1 line
1.7.5.4
#15 lore raw

PATCH 1/5 GCC4.6: Squash warning in nand_bbt.c

In reply to Marek Vasut

Dear Marek Vasut,

Quoted 9 lines · In message <[email protected]> you wrote:

nand_bbt.c: In function `search_bbt?:
nand_bbt.c:465:6: warning: variable `bits? set but not used [-Wunused-but-set-variable]

---
 drivers/mtd/nand/nand_bbt.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When a program is being  tested,  it  is  too  late  to  make  design
changes.                  -- Geoffrey James, "The Tao of Programming"