From: Chanwoo Choi Date: Fri, 19 Jul 2024 10:08:17 +0000 (+0900) Subject: pass: pass-hal: Fix unreachable code when using pass_hal_save_memory_initdata() X-Git-Tag: accepted/tizen/unified/20240722.104306^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4b54718d90997751da36159ab84b07f44cf6b58;p=platform%2Fcore%2Fsystem%2Fpass.git 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 --- 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);