pass: parser: Change board name checking to be an optional 22/276922/2
authorChanwoo Choi <cw00.choi@samsung.com>
Tue, 21 Jun 2022 18:37:49 +0000 (03:37 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 4 Jul 2022 06:43:21 +0000 (15:43 +0900)
The board name checking was mandatory before.
But, the new requirement which supports the PASS daemon
without HAL configuration is requested.
Change board name checking to be an optional.

Change-Id: I64ff9296abc6537057b85a29e9984eefe4e9996a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-parser.c

index e56821c..1bb7d0b 100644 (file)
@@ -55,6 +55,9 @@ static int compare_compatible_name(const char *compatible,
        char buf[BUFF_MAX];
        int len, ret;
 
+       if (!compatible || !path_compatible)
+               return 0;
+
        ret = sys_get_str(path_compatible, buf);
        if (ret < 0) {
                _E("cannot read compatible path: %s\n",
@@ -830,11 +833,12 @@ static int parse_resource(struct pass *pass, json_object *obj)
        if (json_object_object_get_ex(obj, "device_list", &device_list))
                num_resources = json_object_array_length(device_list);
 
+       /* Check the optional property values are valid or not */
+       if (!board_name || !board_name_path)
+               _E("Failed to get 'board_name' or 'board_name_path' property\n");
+
        /* Check the mandatory property values are valid or not */
-       if (!board_name || !board_name_path) {
-               _E("Failed to get 'board_name' property\n");
-               return -EINVAL;
-       } else if (!device_list) {
+       if (!device_list) {
                _E("Failed to get 'device_list' property\n");
                return -EINVAL;
        } else if (num_resources <= 0) {