| 65 | } |
| 66 | |
| 67 | static int append_specific_config(struct nhlt_specific_config *spec_cfg, |
| 68 | const void *config, size_t config_sz) |
| 69 | { |
| 70 | size_t new_sz; |
| 71 | void *new_cfg; |
| 72 | |
| 73 | if (config == NULL || config_sz == 0) |
| 74 | return 0; |
| 75 | |
| 76 | new_sz = spec_cfg->size + config_sz; |
| 77 | |
| 78 | new_cfg = malloc(new_sz); |
| 79 | |
| 80 | if (new_cfg == NULL) |
| 81 | return -1; |
| 82 | |
| 83 | /* Append new config. */ |
| 84 | memcpy(new_cfg, spec_cfg->capabilities, spec_cfg->size); |
| 85 | memcpy(new_cfg + spec_cfg->size, config, config_sz); |
| 86 | |
| 87 | free(spec_cfg->capabilities); |
| 88 | |
| 89 | /* Update with new config data. */ |
| 90 | spec_cfg->size = new_sz; |
| 91 | spec_cfg->capabilities = new_cfg; |
| 92 | |
| 93 | return 0; |
| 94 | } |
| 95 | |
| 96 | int nhlt_endpoint_append_config(struct nhlt_endpoint *endp, const void *config, |
| 97 | size_t config_sz) |
no test coverage detected