From: Kees van Reeuwijk Date: Wed, 20 Jan 2010 17:59:48 +0000 (+0000) Subject: Rewrote a number of cases where variables were used before they initialized. X-Git-Tag: v3.1.6~61 X-Git-Url: http://zhaoyanbai.com/repos//%22https:/www.google.com/jsapi/%22?a=commitdiff_plain;h=53f9f943a8ff17a68df2fa41c0874a790075bca4;p=minix.git Rewrote a number of cases where variables were used before they initialized. --- diff --git a/drivers/audio/framework/audio_fw.c b/drivers/audio/framework/audio_fw.c index 743002cb6..8434c5316 100644 --- a/drivers/audio/framework/audio_fw.c +++ b/drivers/audio/framework/audio_fw.c @@ -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; diff --git a/drivers/bios_wini/bios_wini.c b/drivers/bios_wini/bios_wini.c index cbd615d86..ff5824b69 100644 --- a/drivers/bios_wini/bios_wini.c +++ b/drivers/bios_wini/bios_wini.c @@ -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) diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 8b5be293d..bf8059d5a 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -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)); diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 3be1788bb..79bb5c614 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -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); diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index c09a84467..7a34761cd 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -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; diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 888acf6b5..32e4f0d58 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -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; diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index 867701289..19d9aab4d 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -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;