david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[build] Fix uses of literal 0 as a NULL pointer

Detected using sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2013-04-28 16:51:05 +01:00
parent e5cbfefdf3
commit b9663b8049
13 changed files with 20 additions and 24 deletions

View File

@ -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. */

View File

@ -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);

View File

@ -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);

View File

@ -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, &reg, FCN_INT_ACK_KER_REG_A1 );
mb();
falcon_readl ( efab, &reg,
WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 );

View File

@ -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) {

View File

@ -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)

View File

@ -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 {

View File

@ -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},
};

View File

@ -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 ++)

View File

@ -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; */

View File

@ -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}
};
/**

View File

@ -88,7 +88,7 @@ int wgetnstr ( WINDOW *win, char *str, int n ) {
int c;
if ( n == 0 ) {
str = '\0';
*str = '\0';
return OK;
}

View File

@ -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 */