MCPcopy Create free account
hub / github.com/coreboot/coreboot / append_specific_config

Function append_specific_config

src/lib/nhlt.c:67–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static 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
96int nhlt_endpoint_append_config(struct nhlt_endpoint *endp, const void *config,
97 size_t config_sz)

Callers 2

Calls 3

mallocFunction · 0.70
memcpyFunction · 0.70
freeFunction · 0.70

Tested by

no test coverage detected