Skip to content

Commit 44ed4f9

Browse files
gscuimichalsimek
authored andcommitted
drivers: soc: xilinx: add the missing kfree in xlnx_add_cb_for_suspend()
If we fail to allocate memory for cb_data by kmalloc, the memory allocation for eve_data is never freed, add the missing kfree() in the error handling path. Fixes: 05e5ba4 ("driver: soc: xilinx: Add support of multiple callbacks for same event in event management driver") Signed-off-by: Gaosheng Cui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
1 parent 9852d85 commit 44ed4f9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/soc/xilinx/xlnx_event_manager.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,10 @@ static int xlnx_add_cb_for_suspend(event_cb_func_t cb_fun, void *data)
188188
INIT_LIST_HEAD(&eve_data->cb_list_head);
189189

190190
cb_data = kmalloc(sizeof(*cb_data), GFP_KERNEL);
191-
if (!cb_data)
191+
if (!cb_data) {
192+
kfree(eve_data);
192193
return -ENOMEM;
194+
}
193195
cb_data->eve_cb = cb_fun;
194196
cb_data->agent_data = data;
195197

0 commit comments

Comments
 (0)