OSDN Git Service

perf cs-etm: Fix wrong return values in error path
authorMathieu Poirier <mathieu.poirier@linaro.org>
Tue, 12 Feb 2019 17:16:08 +0000 (10:16 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 14 Feb 2019 18:18:06 +0000 (15:18 -0300)
Function cs_etm__mem_access() is supposed to return a u32 but the error
path returns negative values at a couple of places, something that really
throws off the clients using it.  Fix the situation by return '0'.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki K Poulouse <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190212171618.25355-4-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/cs-etm.c

index 1d9419a..f396fee 100644 (file)
@@ -324,7 +324,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address,
        struct   addr_location al;
 
        if (!etmq)
-               return -1;
+               return 0;
 
        machine = etmq->etm->machine;
        cpumode = cs_etm__cpu_mode(etmq, address);
@@ -332,7 +332,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address,
        thread = etmq->thread;
        if (!thread) {
                if (cpumode != PERF_RECORD_MISC_KERNEL)
-                       return -EINVAL;
+                       return 0;
                thread = etmq->etm->unknown_thread;
        }