[V2 3/3] firmware: arm_sdei: clean up sdei_event_create()

From: luanshi
Date: Wed Jan 15 2020 - 22:29:21 EST


Function sdei_event_find() is always called in sdei_event_create(), but
it is already called in sdei_event_register(). So we should remove some
needless sdei_event_find() calls.

Signed-off-by: Liguang Zhang <zhangliguang@xxxxxxxxxxxxxxxxx>
---
drivers/firmware/arm_sdei.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index f81c09e..79ae07c 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -271,15 +271,9 @@ static struct sdei_event *sdei_event_create(u32 event_num,
event->private_registered = regs;
}

- if (sdei_event_find(event_num)) {
- kfree(event->registered);
- kfree(event);
- event = ERR_PTR(-EBUSY);
- } else {
- spin_lock(&sdei_list_lock);
- list_add(&event->list, &sdei_list);
- spin_unlock(&sdei_list_lock);
- }
+ spin_lock(&sdei_list_lock);
+ list_add(&event->list, &sdei_list);
+ spin_unlock(&sdei_list_lock);

return event;
}
--
1.8.3.1