[components][smp]remove redundant memset & unlock in smp

This commit is contained in:
zms123456 2024-10-11 12:09:28 +08:00 committed by GitHub
parent 5796e0d646
commit 344ea87347
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 6 deletions

View File

@ -33,18 +33,14 @@ static rt_err_t smp_call_handler(struct rt_smp_event *event)
} }
void rt_smp_call_ipi_handler(int vector, void *param) void rt_smp_call_ipi_handler(int vector, void *param)
{ {
int err;
int cur_cpu = rt_hw_cpu_id(); int cur_cpu = rt_hw_cpu_id();
rt_spin_lock(&rt_smp_work[cur_cpu].lock);
rt_spin_lock(&rt_smp_work[cur_cpu].lock);
if (rt_smp_work[cur_cpu].event.event_id) if (rt_smp_work[cur_cpu].event.event_id)
{ {
err = smp_call_handler(&rt_smp_work[cur_cpu].event); if (smp_call_handler(&rt_smp_work[cur_cpu].event) != RT_EOK)
if (err)
{ {
LOG_E("Have no event\n"); LOG_E("Have no event\n");
rt_memset(&rt_smp_work[cur_cpu].event, 0, sizeof(struct rt_smp_event));
rt_spin_unlock(&rt_smp_work[cur_cpu].lock);
} }
rt_memset(&rt_smp_work[cur_cpu].event, 0, sizeof(struct rt_smp_event)); rt_memset(&rt_smp_work[cur_cpu].event, 0, sizeof(struct rt_smp_event));
} }