diff options
author | Michael Brown | 2013-04-28 17:51:05 +0200 |
---|---|---|
committer | Michael Brown | 2013-04-28 18:13:44 +0200 |
commit | b9663b80497d8954a2195789c91ba2f27c8e2d6b (patch) | |
tree | ab39fb8d86da9a90e4dd79b02e18ceeff3aa13bc | |
parent | [build] Use -Wno-decl when running sparse (diff) | |
download | ipxe-b9663b80497d8954a2195789c91ba2f27c8e2d6b.tar.gz ipxe-b9663b80497d8954a2195789c91ba2f27c8e2d6b.tar.xz ipxe-b9663b80497d8954a2195789c91ba2f27c8e2d6b.zip |
[build] Fix uses of literal 0 as a NULL pointer
Detected using sparse.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/drivers/net/3c515.c | 2 | ||||
-rw-r--r-- | src/drivers/net/3c595.c | 4 | ||||
-rw-r--r-- | src/drivers/net/bnx2.c | 3 | ||||
-rw-r--r-- | src/drivers/net/etherfabric.c | 3 | ||||
-rw-r--r-- | src/drivers/net/ns8390.c | 2 | ||||
-rw-r--r-- | src/drivers/net/prism2.c | 4 | ||||
-rw-r--r-- | src/drivers/net/sis900.c | 2 | ||||
-rw-r--r-- | src/drivers/net/tlan.c | 4 | ||||
-rw-r--r-- | src/drivers/net/tulip.c | 8 | ||||
-rw-r--r-- | src/drivers/net/via-velocity.c | 2 | ||||
-rw-r--r-- | src/hci/linux_args.c | 6 | ||||
-rw-r--r-- | src/hci/mucurses/kb.c | 2 | ||||
-rw-r--r-- | src/net/udp/dns.c | 2 |
13 files changed, 20 insertions, 24 deletions
diff --git a/src/drivers/net/3c515.c b/src/drivers/net/3c515.c index 0aa68b1a..1591e061 100644 --- a/src/drivers/net/3c515.c +++ b/src/drivers/net/3c515.c @@ -389,7 +389,7 @@ static void t515_reset(struct nic *nic) outb(PKT_BUF_SZ >> 8, nic->ioaddr + TxFreeThreshold); /* Room for a packet. */ /* Clear the Tx ring. */ for (i = 0; i < TX_RING_SIZE; i++) - vp->tx_skbuff[i] = 0; + vp->tx_skbuff[i] = NULL; outl(0, nic->ioaddr + DownListPtr); } /* Set receiver mode: presumably accept b-case and phys addr only. */ diff --git a/src/drivers/net/3c595.c b/src/drivers/net/3c595.c index 1aa8ed64..2338c54b 100644 --- a/src/drivers/net/3c595.c +++ b/src/drivers/net/3c595.c @@ -399,7 +399,7 @@ vxsetlink(void) i = vx_connector; /* default in EEPROM */ reason = "default"; - warning = 0; + warning = NULL; if ((vx_connectors & conn_tab[vx_connector].bit) == 0) { warning = "strange connector type in EEPROM."; @@ -407,7 +407,7 @@ vxsetlink(void) i = CONNECTOR_UTP; } - if (warning != 0) { + if (warning) { printf("warning: %s\n", warning); } printf("selected %s. (%s)\n", conn_tab[i].name, reason); diff --git a/src/drivers/net/bnx2.c b/src/drivers/net/bnx2.c index a986bdef..4ebcc52a 100644 --- a/src/drivers/net/bnx2.c +++ b/src/drivers/net/bnx2.c @@ -2617,9 +2617,6 @@ bnx2_probe(struct nic *nic, struct pci_device *pdev) struct bnx2 *bp = &bnx2; int i, rc; - if (pdev == 0) - return 0; - memset(bp, 0, sizeof(*bp)); rc = bnx2_init_board(pdev, nic); diff --git a/src/drivers/net/etherfabric.c b/src/drivers/net/etherfabric.c index 6036d321..5e0efb1e 100644 --- a/src/drivers/net/etherfabric.c +++ b/src/drivers/net/etherfabric.c @@ -3798,7 +3798,8 @@ falcon_clear_interrupts ( struct efab_nic *efab ) } else { /* write to the INT_ACK register */ - falcon_writel ( efab, 0, FCN_INT_ACK_KER_REG_A1 ); + EFAB_ZERO_DWORD ( reg ); + falcon_writel ( efab, ®, FCN_INT_ACK_KER_REG_A1 ); mb(); falcon_readl ( efab, ®, WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 ); diff --git a/src/drivers/net/ns8390.c b/src/drivers/net/ns8390.c index a30f9361..0ffc6216 100644 --- a/src/drivers/net/ns8390.c +++ b/src/drivers/net/ns8390.c @@ -895,7 +895,7 @@ static int eth_probe (struct dev *dev, unsigned short *probe_addrs __unused) #endif 0 }; /* if no addresses supplied, fall back on defaults */ - if (probe_addrs == 0 || probe_addrs[0] == 0) + if (probe_addrs == NULL || probe_addrs[0] == 0) probe_addrs = base; eth_bmem = 0; /* No shared memory */ for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) { diff --git a/src/drivers/net/prism2.c b/src/drivers/net/prism2.c index ad388074..ab974264 100644 --- a/src/drivers/net/prism2.c +++ b/src/drivers/net/prism2.c @@ -130,9 +130,7 @@ typedef struct hfa384x } hfa384x_t; /* The global instance of the hardware (i.e. where we store iobase and membase, in the absence of anywhere better to put them */ -static hfa384x_t hw_global = { - 0, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0} -}; +static hfa384x_t hw_global; /* * 802.11 headers in addition to those in hfa384x_tx_frame_t (LLC and SNAP) diff --git a/src/drivers/net/sis900.c b/src/drivers/net/sis900.c index 75e9ef96..72451567 100644 --- a/src/drivers/net/sis900.c +++ b/src/drivers/net/sis900.c @@ -111,7 +111,7 @@ static struct mii_chip_info { // {"NS 83851 PHY",0x2000, 0x5C20, MIX }, {"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8200,rtl8201_read_mode}, {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode}, - {0,0,0,0} + {NULL,0,0,NULL} }; static struct mii_phy { diff --git a/src/drivers/net/tlan.c b/src/drivers/net/tlan.c index 74398df4..7742f6d8 100644 --- a/src/drivers/net/tlan.c +++ b/src/drivers/net/tlan.c @@ -94,7 +94,7 @@ static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16); static const char *media[] = { "10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ", - "100baseTx-FD", "100baseT4", 0 + "100baseTx-FD", "100baseT4", NULL }; /* This much match tlan_pci_tbl[]! */ @@ -164,7 +164,7 @@ static const struct pci_id_info tlan_pci_tbl[] = { {"Compaq NetFlex-3/E", 0, /* EISA card */ {0, 0, 0, 0, 0, 0}, TLAN_ADAPTER_ACTIVITY_LED, 0x83}, - {0, 0, + {NULL, 0, {0, 0, 0, 0, 0, 0}, 0, 0}, }; diff --git a/src/drivers/net/tulip.c b/src/drivers/net/tulip.c index 7a23b7e9..e4e6ffa8 100644 --- a/src/drivers/net/tulip.c +++ b/src/drivers/net/tulip.c @@ -228,7 +228,7 @@ static const struct pci_id_info pci_id_tbl[] = { TULIP_IOTYPE, TULIP_SIZE, COMET }, { "SG Thomson STE10/100A", { 0x2774104a, 0xffffffff, 0, 0, 0, 0 }, TULIP_IOTYPE, 256, COMET }, /*Ramesh Chander*/ - { 0, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 }, + { NULL, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 }, }; enum tbl_flag { @@ -264,7 +264,7 @@ static struct tulip_chip_table { { "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII | HAS_PWRDWN | HAS_NWAY }, { "SGThomson STE10/100A", HAS_MII | MC_HASH_ONLY }, /*Ramesh Chander*/ - { 0, 0 }, + { NULL, 0 }, }; /* A full-duplex map for media types. */ @@ -475,7 +475,7 @@ static struct fixups { 0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */ 0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */ }}, - {0, 0, 0, 0, {}}}; + {NULL, 0, 0, 0, {}}}; static const char * block_name[] = {"21140 non-MII", "21140 MII PHY", "21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"}; @@ -720,7 +720,7 @@ static void parse_eeprom(struct nic *nic) whereami("parse_eeprom\n"); - tp->mtable = 0; + tp->mtable = NULL; /* Detect an old-style (SA only) EEPROM layout: memcmp(ee_data, ee_data+16, 8). */ for (i = 0; i < 8; i ++) diff --git a/src/drivers/net/via-velocity.c b/src/drivers/net/via-velocity.c index 9ba0b093..e98e81a2 100644 --- a/src/drivers/net/via-velocity.c +++ b/src/drivers/net/via-velocity.c @@ -1230,7 +1230,7 @@ static int velocity_open(struct nic *nic, struct pci_device *pci __unused) u32 TxPhyAddr, RxPhyAddr; u32 TxBufPhyAddr, RxBufPhyAddr; vptr->TxDescArrays = tx_ring; - if (vptr->TxDescArrays == 0) + if (vptr->TxDescArrays == NULL) printf("Allot Error"); /* Tx Descriptor needs 64 bytes alignment; */ diff --git a/src/hci/linux_args.c b/src/hci/linux_args.c index 0bce4af9..58eeb063 100644 --- a/src/hci/linux_args.c +++ b/src/hci/linux_args.c @@ -45,9 +45,9 @@ __asmcall void save_args(int argc, char **argv) /** Supported command-line options */ static struct option options[] = { - {"net", 1, 0, 'n'}, - {"settings", 1, 0, 's'}, - {0, 0, 0, 0} + {"net", 1, NULL, 'n'}, + {"settings", 1, NULL, 's'}, + {NULL, 0, NULL, 0} }; /** diff --git a/src/hci/mucurses/kb.c b/src/hci/mucurses/kb.c index cada7291..b38c8c14 100644 --- a/src/hci/mucurses/kb.c +++ b/src/hci/mucurses/kb.c @@ -88,7 +88,7 @@ int wgetnstr ( WINDOW *win, char *str, int n ) { int c; if ( n == 0 ) { - str = '\0'; + *str = '\0'; return OK; } diff --git a/src/net/udp/dns.c b/src/net/udp/dns.c index 613541f5..45f0f07c 100644 --- a/src/net/udp/dns.c +++ b/src/net/udp/dns.c @@ -205,7 +205,7 @@ static char * dns_qualify_name ( const char *string ) { char *fqdn; /* Leave unchanged if already fully-qualified or no local domain */ - if ( ( ! localdomain ) || ( strchr ( string, '.' ) != 0 ) ) + if ( ( ! localdomain ) || ( strchr ( string, '.' ) != NULL ) ) return strdup ( string ); /* Append local domain to name */ |