This is an automated email from Gerrit.

Paul Fertser (fercer...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/2533

-- gerrit

commit 1778ccc868b0192b287d9d81cc7f94eb2786e6e2
Author: Paul Fertser <fercer...@gmail.com>
Date:   Fri Feb 6 18:28:56 2015 +0300

    contrib/itmdump: fix UB in show_swit, and few compile warnings
    
    Change-Id: I1c5c99f190f7b4d405dc6fa06533e7ff37a652ec
    Signed-off-by: Paul Fertser <fercer...@gmail.com>

diff --git a/contrib/itmdump.c b/contrib/itmdump.c
index fe83549..71f6e06 100644
--- a/contrib/itmdump.c
+++ b/contrib/itmdump.c
@@ -105,7 +105,6 @@ static bool read_varlen(FILE *f, int c, unsigned *value)
 {
        unsigned size;
        unsigned char buf[4];
-       unsigned i;
 
        *value = 0;
 
@@ -136,14 +135,13 @@ static bool read_varlen(FILE *f, int c, unsigned *value)
 
 err:
        printf("(ERROR %d - %s)\n", errno, strerror(errno));
-       return;
+       return false;
 }
 
 static void show_hard(FILE *f, int c)
 {
        unsigned type = c >> 3;
        unsigned value;
-       unsigned size;
        char *label;
 
        printf("DWT - ");
@@ -241,9 +239,7 @@ struct {
 
 static void show_swit(FILE *f, int c)
 {
-       unsigned size;
        unsigned port = c >> 3;
-       unsigned char buf[4];
        unsigned value = 0;
        unsigned i;
 
@@ -253,7 +249,7 @@ static void show_swit(FILE *f, int c)
                return;
        printf("%#08x", value);
 
-       for (i = 0; i <= sizeof(format) / sizeof(format[0]); i++) {
+       for (i = 0; i < sizeof(format) / sizeof(format[0]); i++) {
                if (format[i].port == port) {
                        printf(", ");
                        format[i].show(port, value);
@@ -263,10 +259,6 @@ static void show_swit(FILE *f, int c)
 
        printf("\n");
        return;
-
-err:
-       printf("(ERROR %d - %s)\n", errno, strerror(errno));
-       return;
 }
 
 static void show_timestamp(FILE *f, int c)
@@ -367,7 +359,6 @@ int main(int argc, char **argv)
                        }
                        break;
                default:
-usage:
                        fprintf(stderr, "usage: %s [-f input]",
                                basename(argv[0]));
                        return 1;

-- 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to