Hi
> +    if (bootindex >= 0) {
> +        node = g_malloc0(sizeof(FWBootEntry));
> +        node->bootindex = bootindex;
> +        if (suffix) {
> +            node->suffix = g_strdup(suffix);
> +        } else if (old_entry) {
> +            node->suffix = g_strdup(old_entry->suffix);
> +        } else {
> +            node->suffix = NULL;
> +        }
> +        node->dev = dev;
> +
> +        /* add to the global boot list */
> +        QTAILQ_FOREACH(i, &fw_boot_order, link) {
> +            if (i->bootindex < bootindex) {
> +                continue;
> +            }
> +            QTAILQ_INSERT_BEFORE(i, node, link);
> +            goto out;
> +        }
> +
> +        QTAILQ_INSERT_TAIL(&fw_boot_order, node, link);
> +    }

this code can be simply like this:

suffix = suffix ? suffix : old_entry->suffix ? old_entry->suffix : NULL;

add_boot_device_path(boot_index, dev, suffix) 

Best regards
Chen Liang

Reply via email to