From a4b54718d90997751da36159ab84b07f44cf6b58 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 19 Jul 2024 19:08:17 +0900 Subject: [PATCH] pass: pass-hal: Fix unreachable code when using pass_hal_save_memory_initdata() Fix unreachable code when using pass_hal_save_memory_initdata() by returning the error code if failed. Before this patch, the usage code of pass_hal_save_memory_initdata() is not able to receive the any error code. Change-Id: Iba1af390efe74847f384ca60048fe32fbe07b1ab Signed-off-by: Chanwoo Choi --- src/pass/pass-hal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pass/pass-hal.c b/src/pass/pass-hal.c index a5a679d..fbbea84 100644 --- a/src/pass/pass-hal.c +++ b/src/pass/pass-hal.c @@ -676,7 +676,11 @@ static int pass_hal_save_hotplug_initdata(struct pass_resource *res) */ static int pass_hal_save_memory_initdata(struct pass_resource *res) { - struct pass_resource_init_data *initdata = &res->init_data; + struct pass_resource_init_data *initdata; + + if (!res) + return -EINVAL; + initdata = &res->init_data; initdata->memory.fault_around_bytes = pass_hal_get_fault_around_bytes(res); -- 2.34.1