Skip to content

Commit f7d2315

Browse files
committed
performance_monitor: fix issue with freeing bitmap
Zephyr's bitarray had a problem when clearing the bit before freeing it. Not clearing it changes nothing in overall logic so we can just not do it. Also fixes and issue with computing bitmap idx. Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
1 parent aee690a commit f7d2315

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/debug/telemetry/performance_monitor.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,8 @@ struct perf_data_item_comp *perf_data_getnext(void)
145145
int perf_data_free(struct perf_data_item_comp * const item)
146146
{
147147
/* find index of item */
148-
int idx = (item - perf_data) / sizeof(*item);
149-
int ret = perf_bitmap_clearbit(&performance_data_bitmap, idx);
150-
151-
if (ret < 0)
152-
return ret;
153-
ret = perf_bitmap_free(&performance_data_bitmap, idx);
148+
int idx = (item - perf_data);
149+
int ret = perf_bitmap_free(&performance_data_bitmap, idx);
154150
if (ret < 0)
155151
return ret;
156152

@@ -473,10 +469,6 @@ int io_perf_monitor_release_slot(struct io_perf_data_item *item)
473469
k_spin_unlock(&self->lock, key);
474470

475471
/* we assign data items ourselves so neither of those should ever fail */
476-
ret = perf_bitmap_clearbit(&self->io_performance_data_bitmap, idx);
477-
assert(!ret);
478-
if (ret < 0)
479-
return ret;
480472
ret = perf_bitmap_free(&self->io_performance_data_bitmap, idx);
481473
assert(!ret);
482474
return ret;

0 commit comments

Comments
 (0)