Author: stepan Date: Mon Jan 24 20:15:51 2011 New Revision: 1255 URL: http://flashrom.org/trac/flashrom/changeset/1255
Log: 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.
Signed-off-by: Peter Huewe peterhuewe@gmx.de Acked-by: Mathias Krause mathias.krause@secunet.com Acked-by: Stefan Reinauer stepan@coreboot.org
Modified: trunk/cbtable.c trunk/chipset_enable.c trunk/cli_classic.c trunk/physmap.c trunk/programmer.c trunk/serprog.c trunk/udelay.c
Modified: trunk/cbtable.c ============================================================================== --- trunk/cbtable.c Thu Jan 20 22:05:15 2011 (r1254) +++ trunk/cbtable.c Mon Jan 24 20:15:51 2011 (r1255) @@ -141,7 +141,7 @@
};
- return 0; + return NULL; }
static void find_mainboard(struct lb_record *ptr, unsigned long addr)
Modified: trunk/chipset_enable.c ============================================================================== --- trunk/chipset_enable.c Thu Jan 20 22:05:15 2011 (r1254) +++ trunk/chipset_enable.c Mon Jan 24 20:15:51 2011 (r1255) @@ -1173,7 +1173,7 @@
int chipset_flash_enable(void) { - struct pci_dev *dev = 0; + struct pci_dev *dev = NULL; int ret = -2; /* Nothing! */ int i;
Modified: trunk/cli_classic.c ============================================================================== --- trunk/cli_classic.c Thu Jan 20 22:05:15 2011 (r1254) +++ trunk/cli_classic.c Mon Jan 24 20:15:51 2011 (r1255) @@ -116,23 +116,23 @@
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;
Modified: trunk/physmap.c ============================================================================== --- trunk/physmap.c Thu Jan 20 22:05:15 2011 (r1254) +++ trunk/physmap.c Mon Jan 24 20:15:51 2011 (r1255) @@ -180,7 +180,7 @@ } }
- 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 @@ } }
- 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; }
Modified: trunk/programmer.c ============================================================================== --- trunk/programmer.c Thu Jan 20 22:05:15 2011 (r1254) +++ trunk/programmer.c Mon Jan 24 20:15:51 2011 (r1255) @@ -30,7 +30,7 @@ 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 */
Modified: trunk/serprog.c ============================================================================== --- trunk/serprog.c Thu Jan 20 22:05:15 2011 (r1254) +++ trunk/serprog.c Mon Jan 24 20:15:51 2011 (r1255) @@ -541,7 +541,7 @@ { 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;
Modified: trunk/udelay.c ============================================================================== --- trunk/udelay.c Thu Jan 20 22:05:15 2011 (r1254) +++ trunk/udelay.c Mon Jan 24 20:15:51 2011 (r1255) @@ -45,11 +45,11 @@ 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 @@ 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. */