pass: pass-hal: Fix unreachable code when using pass_hal_save_memory_initdata() 09/314809/1 accepted/tizen/unified/20240722.104306 accepted/tizen/unified/dev/20240724.110043 accepted/tizen/unified/toolchain/20240812.133447 accepted/tizen/unified/x/20240723.043617 accepted/tizen/unified/x/asan/20240813.231931
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 19 Jul 2024 10:08:17 +0000 (19:08 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 19 Jul 2024 10:08:17 +0000 (19:08 +0900)
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 <cw00.choi@samsung.com>
src/pass/pass-hal.c

index a5a679d3ddde6eb969da17a75b17afc7d1bf3ada..fbbea840ceef905dc961f127631ab1a4c30d4887 100644 (file)
@@ -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);