mirror of https://github.com/ipxe/ipxe.git
[build] Fix uses of literal 0 as a NULL pointer
Detected using sparse. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/13/head
parent
e5cbfefdf3
commit
b9663b8049
|
@ -389,7 +389,7 @@ static void t515_reset(struct nic *nic)
|
||||||
outb(PKT_BUF_SZ >> 8, nic->ioaddr + TxFreeThreshold); /* Room for a packet. */
|
outb(PKT_BUF_SZ >> 8, nic->ioaddr + TxFreeThreshold); /* Room for a packet. */
|
||||||
/* Clear the Tx ring. */
|
/* Clear the Tx ring. */
|
||||||
for (i = 0; i < TX_RING_SIZE; i++)
|
for (i = 0; i < TX_RING_SIZE; i++)
|
||||||
vp->tx_skbuff[i] = 0;
|
vp->tx_skbuff[i] = NULL;
|
||||||
outl(0, nic->ioaddr + DownListPtr);
|
outl(0, nic->ioaddr + DownListPtr);
|
||||||
}
|
}
|
||||||
/* Set receiver mode: presumably accept b-case and phys addr only. */
|
/* Set receiver mode: presumably accept b-case and phys addr only. */
|
||||||
|
|
|
@ -399,7 +399,7 @@ vxsetlink(void)
|
||||||
|
|
||||||
i = vx_connector; /* default in EEPROM */
|
i = vx_connector; /* default in EEPROM */
|
||||||
reason = "default";
|
reason = "default";
|
||||||
warning = 0;
|
warning = NULL;
|
||||||
|
|
||||||
if ((vx_connectors & conn_tab[vx_connector].bit) == 0) {
|
if ((vx_connectors & conn_tab[vx_connector].bit) == 0) {
|
||||||
warning = "strange connector type in EEPROM.";
|
warning = "strange connector type in EEPROM.";
|
||||||
|
@ -407,7 +407,7 @@ vxsetlink(void)
|
||||||
i = CONNECTOR_UTP;
|
i = CONNECTOR_UTP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (warning != 0) {
|
if (warning) {
|
||||||
printf("warning: %s\n", warning);
|
printf("warning: %s\n", warning);
|
||||||
}
|
}
|
||||||
printf("selected %s. (%s)\n", conn_tab[i].name, reason);
|
printf("selected %s. (%s)\n", conn_tab[i].name, reason);
|
||||||
|
|
|
@ -2617,9 +2617,6 @@ bnx2_probe(struct nic *nic, struct pci_device *pdev)
|
||||||
struct bnx2 *bp = &bnx2;
|
struct bnx2 *bp = &bnx2;
|
||||||
int i, rc;
|
int i, rc;
|
||||||
|
|
||||||
if (pdev == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
memset(bp, 0, sizeof(*bp));
|
memset(bp, 0, sizeof(*bp));
|
||||||
|
|
||||||
rc = bnx2_init_board(pdev, nic);
|
rc = bnx2_init_board(pdev, nic);
|
||||||
|
|
|
@ -3798,7 +3798,8 @@ falcon_clear_interrupts ( struct efab_nic *efab )
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* write to the INT_ACK register */
|
/* 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();
|
mb();
|
||||||
falcon_readl ( efab, ®,
|
falcon_readl ( efab, ®,
|
||||||
WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 );
|
WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 );
|
||||||
|
|
|
@ -895,7 +895,7 @@ static int eth_probe (struct dev *dev, unsigned short *probe_addrs __unused)
|
||||||
#endif
|
#endif
|
||||||
0 };
|
0 };
|
||||||
/* if no addresses supplied, fall back on defaults */
|
/* 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;
|
probe_addrs = base;
|
||||||
eth_bmem = 0; /* No shared memory */
|
eth_bmem = 0; /* No shared memory */
|
||||||
for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) {
|
for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) {
|
||||||
|
|
|
@ -130,9 +130,7 @@ typedef struct hfa384x
|
||||||
} hfa384x_t;
|
} 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 */
|
/* 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 = {
|
static hfa384x_t hw_global;
|
||||||
0, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 802.11 headers in addition to those in hfa384x_tx_frame_t (LLC and SNAP)
|
* 802.11 headers in addition to those in hfa384x_tx_frame_t (LLC and SNAP)
|
||||||
|
|
|
@ -111,7 +111,7 @@ static struct mii_chip_info {
|
||||||
// {"NS 83851 PHY",0x2000, 0x5C20, MIX },
|
// {"NS 83851 PHY",0x2000, 0x5C20, MIX },
|
||||||
{"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8200,rtl8201_read_mode},
|
{"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8200,rtl8201_read_mode},
|
||||||
{"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode},
|
{"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode},
|
||||||
{0,0,0,0}
|
{NULL,0,0,NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mii_phy {
|
static struct mii_phy {
|
||||||
|
|
|
@ -94,7 +94,7 @@ static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16);
|
||||||
|
|
||||||
static const char *media[] = {
|
static const char *media[] = {
|
||||||
"10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
|
"10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
|
||||||
"100baseTx-FD", "100baseT4", 0
|
"100baseTx-FD", "100baseT4", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This much match tlan_pci_tbl[]! */
|
/* 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 */
|
{"Compaq NetFlex-3/E", 0, /* EISA card */
|
||||||
{0, 0, 0, 0, 0, 0},
|
{0, 0, 0, 0, 0, 0},
|
||||||
TLAN_ADAPTER_ACTIVITY_LED, 0x83},
|
TLAN_ADAPTER_ACTIVITY_LED, 0x83},
|
||||||
{0, 0,
|
{NULL, 0,
|
||||||
{0, 0, 0, 0, 0, 0},
|
{0, 0, 0, 0, 0, 0},
|
||||||
0, 0},
|
0, 0},
|
||||||
};
|
};
|
||||||
|
|
|
@ -228,7 +228,7 @@ static const struct pci_id_info pci_id_tbl[] = {
|
||||||
TULIP_IOTYPE, TULIP_SIZE, COMET },
|
TULIP_IOTYPE, TULIP_SIZE, COMET },
|
||||||
{ "SG Thomson STE10/100A", { 0x2774104a, 0xffffffff, 0, 0, 0, 0 },
|
{ "SG Thomson STE10/100A", { 0x2774104a, 0xffffffff, 0, 0, 0, 0 },
|
||||||
TULIP_IOTYPE, 256, COMET }, /*Ramesh Chander*/
|
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 {
|
enum tbl_flag {
|
||||||
|
@ -264,7 +264,7 @@ static struct tulip_chip_table {
|
||||||
{ "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII
|
{ "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII
|
||||||
| HAS_PWRDWN | HAS_NWAY },
|
| HAS_PWRDWN | HAS_NWAY },
|
||||||
{ "SGThomson STE10/100A", HAS_MII | MC_HASH_ONLY }, /*Ramesh Chander*/
|
{ "SGThomson STE10/100A", HAS_MII | MC_HASH_ONLY }, /*Ramesh Chander*/
|
||||||
{ 0, 0 },
|
{ NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A full-duplex map for media types. */
|
/* A full-duplex map for media types. */
|
||||||
|
@ -475,7 +475,7 @@ static struct fixups {
|
||||||
0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */
|
0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */
|
||||||
0x1B05, 0x006D, /* 100baseTx-FD 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",
|
static const char * block_name[] = {"21140 non-MII", "21140 MII PHY",
|
||||||
"21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"};
|
"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");
|
whereami("parse_eeprom\n");
|
||||||
|
|
||||||
tp->mtable = 0;
|
tp->mtable = NULL;
|
||||||
/* Detect an old-style (SA only) EEPROM layout:
|
/* Detect an old-style (SA only) EEPROM layout:
|
||||||
memcmp(ee_data, ee_data+16, 8). */
|
memcmp(ee_data, ee_data+16, 8). */
|
||||||
for (i = 0; i < 8; i ++)
|
for (i = 0; i < 8; i ++)
|
||||||
|
|
|
@ -1230,7 +1230,7 @@ static int velocity_open(struct nic *nic, struct pci_device *pci __unused)
|
||||||
u32 TxPhyAddr, RxPhyAddr;
|
u32 TxPhyAddr, RxPhyAddr;
|
||||||
u32 TxBufPhyAddr, RxBufPhyAddr;
|
u32 TxBufPhyAddr, RxBufPhyAddr;
|
||||||
vptr->TxDescArrays = tx_ring;
|
vptr->TxDescArrays = tx_ring;
|
||||||
if (vptr->TxDescArrays == 0)
|
if (vptr->TxDescArrays == NULL)
|
||||||
printf("Allot Error");
|
printf("Allot Error");
|
||||||
|
|
||||||
/* Tx Descriptor needs 64 bytes alignment; */
|
/* Tx Descriptor needs 64 bytes alignment; */
|
||||||
|
|
|
@ -45,9 +45,9 @@ __asmcall void save_args(int argc, char **argv)
|
||||||
|
|
||||||
/** Supported command-line options */
|
/** Supported command-line options */
|
||||||
static struct option options[] = {
|
static struct option options[] = {
|
||||||
{"net", 1, 0, 'n'},
|
{"net", 1, NULL, 'n'},
|
||||||
{"settings", 1, 0, 's'},
|
{"settings", 1, NULL, 's'},
|
||||||
{0, 0, 0, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,7 +88,7 @@ int wgetnstr ( WINDOW *win, char *str, int n ) {
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if ( n == 0 ) {
|
if ( n == 0 ) {
|
||||||
str = '\0';
|
*str = '\0';
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ static char * dns_qualify_name ( const char *string ) {
|
||||||
char *fqdn;
|
char *fqdn;
|
||||||
|
|
||||||
/* Leave unchanged if already fully-qualified or no local domain */
|
/* Leave unchanged if already fully-qualified or no local domain */
|
||||||
if ( ( ! localdomain ) || ( strchr ( string, '.' ) != 0 ) )
|
if ( ( ! localdomain ) || ( strchr ( string, '.' ) != NULL ) )
|
||||||
return strdup ( string );
|
return strdup ( string );
|
||||||
|
|
||||||
/* Append local domain to name */
|
/* Append local domain to name */
|
||||||
|
|
Loading…
Reference in New Issue