Rewrote a number of cases where variables were used before they initialized.

This commit is contained in:
Kees van Reeuwijk 2010-01-20 17:59:48 +00:00
parent d6383bef47
commit 53f9f943a8
7 changed files with 36 additions and 42 deletions

View file

@ -936,8 +936,8 @@ PRIVATE int init_buffers(sub_dev_t *sub_dev_ptr)
size= sub_dev_ptr->DmaSize + 64 * 1024;
base= alloc_contig(size, AC_ALIGN4K, &ph);
if (!base) {
error("%s: failed to allocate dma buffer for channel %d\n",
drv.DriverName,i);
error("%s: failed to allocate dma buffer for a channel\n",
drv.DriverName);
return EIO;
}
sub_dev_ptr->DmaBuf= base;

View file

@ -422,7 +422,7 @@ PRIVATE void w_init()
/* Ask the system task for a suitable buffer */
if(!(bios_buf_v = alloc_contig(BIOSBUF, AC_LOWER1M, &bios_buf_phys))) {
panic(ME, "allocating bios buffer failed", r);
panic(ME, "allocating bios buffer failed", ENOMEM);
}
if (bios_buf_phys+BIOSBUF > 0x100000)

View file

@ -390,7 +390,7 @@ static int calc_iovec_size(iovec_dat_s_t * iovp)
}
/*
** Name: void do_vwrite_s(message *mp, int vectored)
** Name: void do_vwrite_s(message *mp)
** Function:
*/
static void do_vwrite_s(message * mp)
@ -400,7 +400,7 @@ static void do_vwrite_s(message * mp)
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
panic(dep->de_name, PortErrMsg, port);
panic(__FILE__, PortErrMsg, EINVAL);
dep = &de_table[port];
dep->de_client = mp->DL_PROC;
@ -441,7 +441,7 @@ static void do_vread_s(message * mp)
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
panic(dep->de_name, PortErrMsg, port);
panic(__FILE__, PortErrMsg, EINVAL);
dep = &de_table[port];
dep->de_client = mp->DL_PROC;
@ -484,7 +484,7 @@ static void do_getstat_s(message * mp)
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
panic(dep->de_name, PortErrMsg, port);
panic(__FILE__, PortErrMsg, EINVAL);
dep = &de_table[port];
dep->de_client = mp->DL_PROC;
@ -522,7 +522,7 @@ static void do_stop(message * mp)
port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
panic(dep->de_name, PortErrMsg, port);
panic(__FILE__, PortErrMsg, EINVAL);
dep = &de_table[port];
if (dep->de_mode == DEM_ENABLED && (dep->de_flags & DEF_ENABLED)) {
@ -598,7 +598,9 @@ PUBLIC int main(int argc, char **argv)
sef_local_startup();
while (TRUE) {
if ((rc = sef_receive(ANY, &m)) != OK) panic(dep->de_name, RecvErrMsg, rc);
if ((rc = sef_receive(ANY, &m)) != OK){
panic(__FILE__, RecvErrMsg, rc);
}
DEBUG(printf("eth: got message %d, ", m.m_type));

View file

@ -410,7 +410,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
eth_ign_proto= htons((u16_t) v);
if(!(fxp_table = alloc_contig(ft, 0, &fxp_table_phys)))
panic("FXP","couldn't allocate table", r);
panic("FXP","couldn't allocate table", ENOMEM);
memset(fxp_table, 0, ft);

View file

@ -472,7 +472,6 @@ static void or_reset() {
t_or *orp;
int i, j, r;
u16_t irqmask;
hermes_t *hw = &(orp->hw);
if (OK != (r = getuptime(&now)))
panic(__FILE__, "orinoco: getuptime() failed:", r);
@ -518,7 +517,6 @@ static void or_dump (message *m) {
t_or *orp;
int i, err;
u16_t evstat =0, d;
hermes_t *hw;
for (i = 0, orp = or_table; orp < or_table + OR_PORT_NR; i++, orp++) {
if(orp->or_mode == OR_M_DISABLED) {
@ -1377,7 +1375,8 @@ static void or_writev (message * mp, int from_int, int vectored) {
struct ethhdr *eh;
t_or *orp;
clock_t timebefore, t0;
phys_bytes phys_user, iov_src;
phys_bytes phys_user;
phys_bytes iov_src = 0;
hermes_t *hw;
struct hermes_tx_descriptor desc;
struct header_struct hdr;
@ -1545,7 +1544,8 @@ static void or_writev_s (message * mp, int from_int) {
struct ethhdr *eh;
t_or *orp;
clock_t timebefore, t0;
phys_bytes phys_user, iov_src;
phys_bytes phys_user;
phys_bytes iov_src = 0;
hermes_t *hw;
struct hermes_tx_descriptor desc;
int iov_offset = 0;
@ -1992,7 +1992,8 @@ static void or_readv (message * mp, int from_int, int vectored) {
clock_t timebefore;
unsigned amount, totlen, packlen;
struct hermes_rx_descriptor desc;
phys_bytes dst_phys, iov_src;
phys_bytes dst_phys;
phys_bytes iov_src = 0;
u16_t d_start, d_end, rxfid, status;
struct header_struct hdr;
int length, offset;
@ -2115,7 +2116,8 @@ static void or_readv_s (message * mp, int from_int) {
clock_t timebefore;
unsigned amount, totlen, packlen;
struct hermes_rx_descriptor desc;
phys_bytes dst_phys, iov_src;
phys_bytes dst_phys;
phys_bytes iov_src = 0;
u16_t d_start, d_end, rxfid, status;
struct header_struct hdr;
u32_t l, rxstat;

View file

@ -974,15 +974,13 @@ re_t *rep;
/*===========================================================================*
* rl_readv *
*===========================================================================*/
static void rl_readv(mp, from_int, vectored)
message *mp;
int from_int;
int vectored;
static void rl_readv(message *mp, int from_int, int vectored)
{
int i, j, n, o, s, s1, dl_port, re_client, count, size;
port_t port;
unsigned amount, totlen, packlen;
phys_bytes src_phys, dst_phys, iov_src;
phys_bytes src_phys, dst_phys;
phys_bytes iov_src = 0;
u16_t d_start, d_end;
u32_t l, rxstat = 0x12345678;
re_t *rep;
@ -1226,14 +1224,13 @@ suspend:
/*===========================================================================*
* rl_readv_s *
*===========================================================================*/
static void rl_readv_s(mp, from_int)
message *mp;
int from_int;
static void rl_readv_s(message *mp, int from_int)
{
int i, j, n, o, s, s1, dl_port, re_client, count, size;
port_t port;
unsigned amount, totlen, packlen;
phys_bytes src_phys, dst_phys, iov_src;
phys_bytes src_phys, dst_phys;
phys_bytes iov_src = 0;
u16_t d_start, d_end;
u32_t l, rxstat = 0x12345678;
re_t *rep;
@ -1464,12 +1461,10 @@ suspend:
/*===========================================================================*
* rl_writev *
*===========================================================================*/
static void rl_writev(mp, from_int, vectored)
message *mp;
int from_int;
int vectored;
static void rl_writev(message *mp, int from_int, int vectored)
{
phys_bytes iov_src, phys_user;
phys_bytes iov_src = 0;
phys_bytes phys_user;
int i, j, n, s, port, count, size;
int tx_head, re_client;
re_t *rep;
@ -1611,11 +1606,9 @@ suspend:
/*===========================================================================*
* rl_writev_s *
*===========================================================================*/
static void rl_writev_s(mp, from_int)
message *mp;
int from_int;
static void rl_writev_s(message *mp, int from_int)
{
phys_bytes iov_src;
phys_bytes iov_src = 0;
int i, j, n, s, port, count, size;
int tx_head, re_client;
re_t *rep;

View file

@ -1300,14 +1300,13 @@ void transmittest(re_t *rep)
/*===========================================================================*
* rl_readv_s *
*===========================================================================*/
static void rl_readv_s(mp, from_int)
message *mp;
int from_int;
static void rl_readv_s(message *mp, int from_int)
{
int i, j, n, s, dl_port, re_client, count, size, index;
port_t port;
unsigned totlen, packlen;
phys_bytes src_phys, iov_src;
phys_bytes src_phys;
phys_bytes iov_src = 0;
re_desc *desc;
u32_t rxstat = 0x12345678;
re_t *rep;
@ -1449,11 +1448,9 @@ suspend:
/*===========================================================================*
* rl_writev_s *
*===========================================================================*/
static void rl_writev_s(mp, from_int)
message *mp;
int from_int;
static void rl_writev_s(message *mp, int from_int)
{
phys_bytes iov_src;
phys_bytes iov_src = 0;
int i, j, n, s, port, count, size;
int tx_head, re_client;
re_t *rep;