diff options
author | Mathieu Poirier <mathieu.poirier@linaro.org> | 2016-09-08 18:50:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-09 07:52:59 -0400 |
commit | 8e67cdbc2f7b57bc1448c505ce5c20e60238728b (patch) | |
tree | df128c8ebe563e049eb5006ca0b50a91f6e8907d /drivers/hwtracing | |
parent | 3ba1eb17b633b419737b65429fa7124ce87c5efc (diff) |
coresight: perf: deal with error condition properly
Function coresight_build_path() should return -ENOMEM when kzalloc
fails to allocated the requested memory. That way callers can deal
with the error condition in a similar way.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r-- | drivers/hwtracing/coresight/coresight-etm-perf.c | 4 | ||||
-rw-r--r-- | drivers/hwtracing/coresight/coresight.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 98eb207684fa..2cd7c718198a 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c | |||
@@ -135,7 +135,7 @@ static void free_event_data(struct work_struct *work) | |||
135 | } | 135 | } |
136 | 136 | ||
137 | for_each_cpu(cpu, mask) { | 137 | for_each_cpu(cpu, mask) { |
138 | if (event_data->path[cpu]) | 138 | if (!(IS_ERR_OR_NULL(event_data->path[cpu]))) |
139 | coresight_release_path(event_data->path[cpu]); | 139 | coresight_release_path(event_data->path[cpu]); |
140 | } | 140 | } |
141 | 141 | ||
@@ -220,7 +220,7 @@ static void *etm_setup_aux(int event_cpu, void **pages, | |||
220 | * referenced later when the path is actually needed. | 220 | * referenced later when the path is actually needed. |
221 | */ | 221 | */ |
222 | event_data->path[cpu] = coresight_build_path(csdev); | 222 | event_data->path[cpu] = coresight_build_path(csdev); |
223 | if (!event_data->path[cpu]) | 223 | if (IS_ERR(event_data->path[cpu])) |
224 | goto err; | 224 | goto err; |
225 | } | 225 | } |
226 | 226 | ||
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index fcbedd3905e3..7bf00a0beb6f 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c | |||
@@ -429,7 +429,7 @@ struct list_head *coresight_build_path(struct coresight_device *csdev) | |||
429 | 429 | ||
430 | path = kzalloc(sizeof(struct list_head), GFP_KERNEL); | 430 | path = kzalloc(sizeof(struct list_head), GFP_KERNEL); |
431 | if (!path) | 431 | if (!path) |
432 | return NULL; | 432 | return ERR_PTR(-ENOMEM); |
433 | 433 | ||
434 | INIT_LIST_HEAD(path); | 434 | INIT_LIST_HEAD(path); |
435 | 435 | ||