From 7609cb258d4975e49b020860f8ebba6feb5f2354 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 15 Oct 2025 15:18:05 +0200 Subject: [PATCH] lib/configs: simplify merge error checking Combine the three config_merge_list() calls into a single conditional statement to reduce repetitive error checking. The calls are short-circuited on first failure. Signed-off-by: Karel Zak --- lib/configs.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/configs.c b/lib/configs.c index 87e17fa0c..aaf55d42d 100644 --- a/lib/configs.c +++ b/lib/configs.c @@ -273,16 +273,9 @@ int ul_configs_file_list(struct list_head *file_list, #endif /* Merge drop-in directories in priority order (high to low) */ - ret = config_merge_list(file_list, &etc_list); - if (ret < 0) - goto finish; - - ret = config_merge_list(file_list, &run_list); - if (ret < 0) - goto finish; - - ret = config_merge_list(file_list, &usr_list); - if (ret < 0) + if ((ret = config_merge_list(file_list, &etc_list)) < 0 || + (ret = config_merge_list(file_list, &run_list)) < 0 || + (ret = config_merge_list(file_list, &usr_list)) < 0) goto finish; /* Add main config file at the beginning (highest priority) */ -- 2.47.3