Author: stepan Date: 2009-09-16 10:18:08 +0200 (Wed, 16 Sep 2009) New Revision: 722
Modified: trunk/serprog.c trunk/sharplhf00l04.c trunk/sst28sf040.c trunk/stm50flw0x0x.c Log: this patch fixes all 27 flashrom source code issues reported by LLVM/clang's scan-build (r79326, new build on the way).
Signed-off-by: Stefan Reinauer stepan@coresystems.de
This commit fixes only some of the issues, those that were Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/serprog.c =================================================================== --- trunk/serprog.c 2009-09-09 00:58:19 UTC (rev 721) +++ trunk/serprog.c 2009-09-16 08:18:08 UTC (rev 722) @@ -95,7 +95,7 @@ whether the command is supported before doing it */ static int sp_check_avail_automatic = 0;
-static void sp_die(char *msg) +static void __attribute__((noreturn)) sp_die(char *msg) { perror(msg); exit(1);
Modified: trunk/sharplhf00l04.c =================================================================== --- trunk/sharplhf00l04.c 2009-09-09 00:58:19 UTC (rev 721) +++ trunk/sharplhf00l04.c 2009-09-16 08:18:08 UTC (rev 722) @@ -73,7 +73,6 @@ uint8_t wait_lhf00l04(chipaddr bios) { uint8_t status; - uint8_t id1, id2;
chip_writeb(0x70, bios); if ((chip_readb(bios) & 0x80) == 0) { // it's busy @@ -82,13 +81,13 @@
status = chip_readb(bios);
- // put another command to get out of status register mode + // put another command to get out of status register mode.
chip_writeb(0x90, bios); programmer_delay(10);
- id1 = chip_readb(bios); - id2 = chip_readb(bios + 0x01); + chip_readb(bios); // vendor ID + chip_readb(bios + 0x01); // device ID
// this is needed to jam it out of "read id" mode chip_writeb(0xAA, bios + 0x5555);
Modified: trunk/sst28sf040.c =================================================================== --- trunk/sst28sf040.c 2009-09-09 00:58:19 UTC (rev 721) +++ trunk/sst28sf040.c 2009-09-16 08:18:08 UTC (rev 722) @@ -30,28 +30,24 @@
static void protect_28sf040(chipaddr bios) { - uint8_t tmp; - - tmp = chip_readb(bios + 0x1823); - tmp = chip_readb(bios + 0x1820); - tmp = chip_readb(bios + 0x1822); - tmp = chip_readb(bios + 0x0418); - tmp = chip_readb(bios + 0x041B); - tmp = chip_readb(bios + 0x0419); - tmp = chip_readb(bios + 0x040A); + chip_readb(bios + 0x1823); + chip_readb(bios + 0x1820); + chip_readb(bios + 0x1822); + chip_readb(bios + 0x0418); + chip_readb(bios + 0x041B); + chip_readb(bios + 0x0419); + chip_readb(bios + 0x040A); }
static void unprotect_28sf040(chipaddr bios) { - uint8_t tmp; - - tmp = chip_readb(bios + 0x1823); - tmp = chip_readb(bios + 0x1820); - tmp = chip_readb(bios + 0x1822); - tmp = chip_readb(bios + 0x0418); - tmp = chip_readb(bios + 0x041B); - tmp = chip_readb(bios + 0x0419); - tmp = chip_readb(bios + 0x041A); + chip_readb(bios + 0x1823); + chip_readb(bios + 0x1820); + chip_readb(bios + 0x1822); + chip_readb(bios + 0x0418); + chip_readb(bios + 0x041B); + chip_readb(bios + 0x0419); + chip_readb(bios + 0x041A); }
static int erase_sector_28sf040(struct flashchip *flash, unsigned long address, int sector_size)
Modified: trunk/stm50flw0x0x.c =================================================================== --- trunk/stm50flw0x0x.c 2009-09-09 00:58:19 UTC (rev 721) +++ trunk/stm50flw0x0x.c 2009-09-16 08:18:08 UTC (rev 722) @@ -54,19 +54,17 @@
static void wait_stm50flw0x0x(chipaddr bios) { - uint8_t id1; - // id2; - chip_writeb(0x70, bios); if ((chip_readb(bios) & 0x80) == 0) { // it's busy while ((chip_readb(bios) & 0x80) == 0) ; } + // put another command to get out of status register mode
chip_writeb(0x90, bios); programmer_delay(10);
- id1 = chip_readb(bios); + chip_readb(bios); // Read device ID (to make sure?)
// this is needed to jam it out of "read id" mode chip_writeb(0xAA, bios + 0x5555);