summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2009-09-16 08:18:08 +0000
committerStefan Reinauer <stefan.reinauer@coreboot.org>2009-09-16 08:18:08 +0000
commit9e72aa51a7a9ac5f041bacab75fd4be1e2a3356c (patch)
tree375d71717241476bec265568958024db7eee3e37
parentb08ee5c50619d90fd35a1dd06228b952c67dda0b (diff)
downloadflashrom-9e72aa51a7a9ac5f041bacab75fd4be1e2a3356c.tar.gz
flashrom-9e72aa51a7a9ac5f041bacab75fd4be1e2a3356c.tar.bz2
flashrom-9e72aa51a7a9ac5f041bacab75fd4be1e2a3356c.zip
Fix some of the issues reported by LLVM/clang's scan-build
Corresponding to flashrom svn r722. 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>
-rw-r--r--serprog.c2
-rw-r--r--sharplhf00l04.c7
-rw-r--r--sst28sf040.c32
-rw-r--r--stm50flw0x0x.c6
4 files changed, 20 insertions, 27 deletions
diff --git a/serprog.c b/serprog.c
index ee72da3e1..69d0c080b 100644
--- a/serprog.c
+++ b/serprog.c
@@ -95,7 +95,7 @@ static int sp_opbuf_usage = 0;
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);
diff --git a/sharplhf00l04.c b/sharplhf00l04.c
index 03bb2cef2..c4c0f03e8 100644
--- a/sharplhf00l04.c
+++ b/sharplhf00l04.c
@@ -73,7 +73,6 @@ int probe_lhf00l04(struct flashchip *flash)
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 @@ uint8_t wait_lhf00l04(chipaddr bios)
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);
diff --git a/sst28sf040.c b/sst28sf040.c
index d3d7bdb3d..930ad5bee 100644
--- a/sst28sf040.c
+++ b/sst28sf040.c
@@ -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)
diff --git a/stm50flw0x0x.c b/stm50flw0x0x.c
index 8cbafe2b5..44819e5e5 100644
--- a/stm50flw0x0x.c
+++ b/stm50flw0x0x.c
@@ -54,19 +54,17 @@ int probe_stm50flw0x0x(struct flashchip *flash)
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);