Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
[oweals/u-boot.git] / tools / proftool.c
index aa05e77ece547f352f1c0919dcf21f8b8a093773..fecb9d6e99c254e412db87a4a22eb4a4d6caca91 100644 (file)
@@ -1,20 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2013 Google, Inc
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
  */
 
 /* Decode and dump U-Boot profiling information */
@@ -29,6 +15,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/param.h>
+#include <sys/types.h>
 
 #include <compiler.h>
 #include <trace.h>
@@ -218,12 +205,12 @@ static struct func_info *find_caller_by_offset(uint32_t offset)
        return low >= 0 ? &func_list[low] : NULL;
 }
 
-static int read_calls(FILE *fin, int count)
+static int read_calls(FILE *fin, size_t count)
 {
        struct trace_call *call_data;
        int i;
 
-       notice("call count: %d\n", count);
+       notice("call count: %zu\n", count);
        call_list = (struct trace_call *)calloc(count, sizeof(*call_data));
        if (!call_list) {
                error("Cannot allocate call_list\n");
@@ -444,9 +431,10 @@ static int read_trace_config(FILE *fin)
 
                err = regcomp(&line->regex, tok, REG_NOSUB);
                if (err) {
+                       int r = regex_report_error(&line->regex, err,
+                                                  "compile", tok);
                        free(line);
-                       return regex_report_error(&line->regex, err, "compile",
-                                                 tok);
+                       return r;
                }
 
                /* link this new one to the end of the list */