OSDN Git Service

firmware: arm_sdei: Common block for failing path in sdei_event_create()
authorGavin Shan <gshan@redhat.com>
Tue, 22 Sep 2020 13:04:12 +0000 (23:04 +1000)
committerWill Deacon <will@kernel.org>
Mon, 28 Sep 2020 20:52:22 +0000 (21:52 +0100)
commit119884249fdba34a06df250a4402a6b2f3697a47
tree962d1a11127cb5ce392acad9b96c3ccd2b3a4f1e
parent5735f515843019257913432a8c36eb558be388db
firmware: arm_sdei: Common block for failing path in sdei_event_create()

There are multiple calls of kfree(event) in the failing path of
sdei_event_create() to free the SDEI event. It means we need to
call it again when adding more code in the failing path. It's
prone to miss doing that and introduce memory leakage.

This introduces common block for failing path in sdei_event_create()
to resolve the issue. This shouldn't cause functional changes.

Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: James Morse <james.morse@arm.com>
Link: https://lore.kernel.org/r/20200922130423.10173-3-gshan@redhat.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/firmware/arm_sdei.c