flashrom: fix sparse warning: Using plain integer as NULL pointer
This patch fixes the "using plain integer as NULL pointer" warnings generated by running sparse on the flashrom source.
Flashrom-Version: r1254
Signed-off-by: Peter Huewe peterhuewe@gmx.de --- cbtable.c | 2 +- chipset_enable.c | 2 +- cli_classic.c | 34 +++++++++++++++++----------------- physmap.c | 4 ++-- programmer.c | 2 +- serprog.c | 2 +- udelay.c | 8 ++++---- 7 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/cbtable.c b/cbtable.c index dbb2cff..f30a3ae 100644 --- a/cbtable.c +++ b/cbtable.c @@ -141,7 +141,7 @@ static struct lb_header *find_lb_table(void *base, unsigned long start,
};
- return 0; + return NULL; }
static void find_mainboard(struct lb_record *ptr, unsigned long addr) diff --git a/chipset_enable.c b/chipset_enable.c index 6d6008e..0896bce 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -1173,7 +1173,7 @@ const struct penable chipset_enables[] = {
int chipset_flash_enable(void) { - struct pci_dev *dev = 0; + struct pci_dev *dev = NULL; int ret = -2; /* Nothing! */ int i;
diff --git a/cli_classic.c b/cli_classic.c index 1211989..88b70db 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -116,23 +116,23 @@ int cli_classic(int argc, char *argv[])
static const char optstring[] = "r:Rw:v:nVEfc:m:l:i:p:Lzh"; static const struct option long_options[] = { - {"read", 1, 0, 'r'}, - {"write", 1, 0, 'w'}, - {"erase", 0, 0, 'E'}, - {"verify", 1, 0, 'v'}, - {"noverify", 0, 0, 'n'}, - {"chip", 1, 0, 'c'}, - {"mainboard", 1, 0, 'm'}, - {"verbose", 0, 0, 'V'}, - {"force", 0, 0, 'f'}, - {"layout", 1, 0, 'l'}, - {"image", 1, 0, 'i'}, - {"list-supported", 0, 0, 'L'}, - {"list-supported-wiki", 0, 0, 'z'}, - {"programmer", 1, 0, 'p'}, - {"help", 0, 0, 'h'}, - {"version", 0, 0, 'R'}, - {0, 0, 0, 0} + {"read", 1, NULL, 'r'}, + {"write", 1, NULL, 'w'}, + {"erase", 0, NULL, 'E'}, + {"verify", 1, NULL, 'v'}, + {"noverify", 0, NULL, 'n'}, + {"chip", 1, NULL, 'c'}, + {"mainboard", 1, NULL, 'm'}, + {"verbose", 0, NULL, 'V'}, + {"force", 0, NULL, 'f'}, + {"layout", 1, NULL, 'l'}, + {"image", 1, NULL, 'i'}, + {"list-supported", 0, NULL, 'L'}, + {"list-supported-wiki", 0, NULL, 'z'}, + {"programmer", 1, NULL, 'p'}, + {"help", 0, NULL, 'h'}, + {"version", 0, NULL, 'R'}, + {NULL, 0, NULL, 0} };
char *filename = NULL; diff --git a/physmap.c b/physmap.c index 4641e8e..70156a6 100644 --- a/physmap.c +++ b/physmap.c @@ -180,7 +180,7 @@ static void *sys_physmap_rw_uncached(unsigned long phys_addr, size_t len) } }
- virt_addr = mmap(0, len, PROT_WRITE | PROT_READ, MAP_SHARED, + virt_addr = mmap(NULL, len, PROT_WRITE | PROT_READ, MAP_SHARED, fd_mem, (off_t)phys_addr); return MAP_FAILED == virt_addr ? ERROR_PTR : virt_addr; } @@ -200,7 +200,7 @@ static void *sys_physmap_ro_cached(unsigned long phys_addr, size_t len) } }
- virt_addr = mmap(0, len, PROT_READ, MAP_SHARED, + virt_addr = mmap(NULL, len, PROT_READ, MAP_SHARED, fd_mem_cached, (off_t)phys_addr); return MAP_FAILED == virt_addr ? ERROR_PTR : virt_addr; } diff --git a/programmer.c b/programmer.c index 0160867..5c1f963 100644 --- a/programmer.c +++ b/programmer.c @@ -30,7 +30,7 @@ int noop_shutdown(void) void *fallback_map(const char *descr, unsigned long phys_addr, size_t len) { /* FIXME: Should return phys_addr. */ - return 0; + return NULL; }
/* No-op/fallback unmap() for programmers which don't need special handling */ diff --git a/serprog.c b/serprog.c index 2cdfea6..f869b07 100644 --- a/serprog.c +++ b/serprog.c @@ -541,7 +541,7 @@ static void sp_execute_opbuf_noflush(void) { if ((sp_max_write_n) && (sp_write_n_bytes)) sp_pass_writen(); - sp_stream_buffer_op(S_CMD_O_EXEC, 0, 0); + sp_stream_buffer_op(S_CMD_O_EXEC, 0, NULL); msg_pspew(MSGHEADER "Executed operation buffer of %d bytes\n", sp_opbuf_usage); sp_opbuf_usage = 0; diff --git a/udelay.c b/udelay.c index 153f510..feae827 100644 --- a/udelay.c +++ b/udelay.c @@ -45,11 +45,11 @@ static unsigned long measure_os_delay_resolution(void) struct timeval start, end; unsigned long counter = 0; - gettimeofday(&start, 0); + gettimeofday(&start, NULL); timeusec = 0; while (!timeusec && (++counter < 1000000000)) { - gettimeofday(&end, 0); + gettimeofday(&end, NULL); timeusec = 1000000 * (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec); /* Protect against time going forward too much. */ @@ -68,9 +68,9 @@ static unsigned long measure_delay(int usecs) unsigned long timeusec; struct timeval start, end; - gettimeofday(&start, 0); + gettimeofday(&start, NULL); myusec_delay(usecs); - gettimeofday(&end, 0); + gettimeofday(&end, NULL); timeusec = 1000000 * (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec); /* Protect against time going forward too much. */
On 22.01.2011 21:19, Peter Hüwe wrote:
flashrom: fix sparse warning: Using plain integer as NULL pointer
This patch fixes the "using plain integer as NULL pointer" warnings generated by running sparse on the flashrom source.
Flashrom-Version: r1254
Looks good to me.
Signed-off-by: Peter Huewe peterhuewe@gmx.de
Acked-by: Mathias Krause mathias.krause@secunet.com
Am 24.01.2011 09:52 schrieb Mathias Krause:
On 22.01.2011 21:19, Peter Hüwe wrote:
flashrom: fix sparse warning: Using plain integer as NULL pointer
This patch fixes the "using plain integer as NULL pointer" warnings generated by running sparse on the flashrom source.
Flashrom-Version: r1254
Looks good to me.
Signed-off-by: Peter Huewe peterhuewe@gmx.de
Acked-by: Mathias Krause mathias.krause@secunet.com
This was committed in r1255.
Regards, Carl-Daniel