From: David van Moolenbroek Date: Fri, 27 Jul 2012 14:49:55 +0000 (+0000) Subject: at_wini: resolve Coverity warnings X-Git-Tag: v3.2.1~426 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=0ae965217738d3ef36ae2ff60aeb3810a2ec8066;p=minix.git at_wini: resolve Coverity warnings --- diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index 312d6a6f8..d8e0d5a18 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -1500,7 +1500,6 @@ static int setup_dma( int i, j, r; u32_t v; struct wini *wn = w_wn; - int verbose = 0; /* First try direct scatter/gather to the supplied buffers */ size= *sizep; @@ -1508,16 +1507,17 @@ static int setup_dma( j= 0; /* prdt index */ offset= 0; /* Offset in current iov */ - if(verbose) - printf("at_wini: setup_dma: proc_nr %d\n", proc_nr); +#if VERBOSE_DMA + printf("at_wini: setup_dma: proc_nr %d\n", proc_nr); +#endif while (size > 0) { - if(verbose) { - printf( +#if VERBOSE_DMA + printf( "at_wini: setup_dma: iov[%d]: addr 0x%lx, size %ld offset %d, size %d\n", i, iov[i].iov_addr, iov[i].iov_size, offset, size); - } +#endif n= iov[i].iov_size-offset; if (n > size) @@ -1580,14 +1580,14 @@ static int setup_dma( panic("bad prdt index: %d", j); prdt[j-1].prdte_flags |= PRDTE_FL_EOT; - if(verbose) { - printf("dma not bad\n"); - for (i= 0; ibase_dma + DMA_STATUS, &v); @@ -2321,8 +2321,8 @@ static void ack_irqs(unsigned int irqs) } -#define STSTR(a) if (status & STATUS_ ## a) { strcat(str, #a); strcat(str, " "); } -#define ERRSTR(a) if (e & ERROR_ ## a) { strcat(str, #a); strcat(str, " "); } +#define STSTR(a) if (status & STATUS_ ## a) strlcat(str, #a " ", sizeof(str)); +#define ERRSTR(a) if (e & ERROR_ ## a) strlcat(str, #a " ", sizeof(str)); static char *strstatus(int status) { static char str[200]; diff --git a/drivers/at_wini/at_wini.h b/drivers/at_wini/at_wini.h index 4b848fce7..e5d3f0e4d 100644 --- a/drivers/at_wini/at_wini.h +++ b/drivers/at_wini/at_wini.h @@ -3,6 +3,7 @@ #include #define VERBOSE 0 /* display identify messages during boot */ +#define VERBOSE_DMA 0 /* display DMA debugging information */ #define ENABLE_ATAPI 1 /* add ATAPI cd-rom support to driver */ #define ATAPI_DEBUG 0 /* To debug ATAPI code. */