Skip to content

Commit 5e82c8f

Browse files
Jyri Sarhakv2019i
authored andcommitted
tools: tplg_parser: Add () around all macro argument instances
Add () around all macro argument instances. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent f40de65 commit 5e82c8f

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

tools/tplg_parser/include/tplg_parser/topology.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ struct tplg_context {
199199
#define tplg_check_bounds(ctx, advance) \
200200
do { \
201201
if ((long)(advance) < 0 || \
202-
ctx->tplg_offset + (long)(advance) > (long)ctx->tplg_size) { \
202+
(ctx)->tplg_offset + (long)(advance) > (long)(ctx)->tplg_size) { \
203203
printf("%s %d topology offset %ld + %ld > size %zu\n", \
204204
__func__, __LINE__, (ctx)->tplg_offset, \
205205
(long)(advance), (ctx)->tplg_size); \
@@ -210,51 +210,51 @@ struct tplg_context {
210210
#define tplg_get_hdr(ctx) \
211211
({struct snd_soc_tplg_hdr *ptr; \
212212
tplg_check_bounds(ctx, sizeof(*ptr)); \
213-
ptr = (struct snd_soc_tplg_hdr *)(ctx->tplg_base + ctx->tplg_offset); \
213+
ptr = (struct snd_soc_tplg_hdr *)((ctx)->tplg_base + (ctx)->tplg_offset); \
214214
if (ptr->size != sizeof(*ptr)) { \
215215
printf("%s %d hdr size mismatch 0x%x:0x%zx at offset %ld\n", \
216216
__func__, __LINE__, ptr->size, sizeof(*ptr), \
217-
ctx->tplg_offset); assert(0); \
217+
(ctx)->tplg_offset); assert(0); \
218218
} \
219219
ctx->tplg_offset += sizeof(*ptr); (void *)ptr; })
220220

221221
#define tplg_skip_hdr_payload(ctx) \
222222
({struct snd_soc_tplg_hdr *ptr; \
223223
tplg_check_bounds(ctx, hdr->payload_size); \
224-
ptr = (struct snd_soc_tplg_hdr *)(ctx->tplg_base + ctx->tplg_offset); \
225-
ctx->tplg_offset += hdr->payload_size; (void *)ptr; })
224+
ptr = (struct snd_soc_tplg_hdr *)((ctx)->tplg_base + (ctx)->tplg_offset); \
225+
(ctx)->tplg_offset += hdr->payload_size; (void *)ptr; })
226226

227227
#define tplg_get_object(ctx, obj) \
228228
({void *ptr; \
229229
tplg_check_bounds(ctx, sizeof(*(obj))); \
230-
ptr = ctx->tplg_base + ctx->tplg_offset; \
231-
ctx->tplg_offset += sizeof(*(obj)); ptr; })
230+
ptr = (ctx)->tplg_base + (ctx)->tplg_offset; \
231+
(ctx)->tplg_offset += sizeof(*(obj)); ptr; })
232232

233233
#define tplg_get_object_priv(ctx, obj, priv_size) \
234234
({void *ptr; \
235235
tplg_check_bounds(ctx, sizeof(*(obj)) + (priv_size)); \
236-
ptr = ctx->tplg_base + ctx->tplg_offset; \
237-
ctx->tplg_offset += sizeof(*(obj)) + priv_size; ptr; })
236+
ptr = (ctx)->tplg_base + (ctx)->tplg_offset; \
237+
(ctx)->tplg_offset += sizeof(*(obj)) + (priv_size); ptr; })
238238

239239
#define tplg_get_widget(ctx) \
240240
({struct snd_soc_tplg_dapm_widget *w; \
241241
tplg_check_bounds(ctx, sizeof(*w)); \
242-
w = (struct snd_soc_tplg_dapm_widget *)(ctx->tplg_base + ctx->tplg_offset); \
242+
w = (struct snd_soc_tplg_dapm_widget *)((ctx)->tplg_base + (ctx)->tplg_offset); \
243243
tplg_check_bounds(ctx, sizeof(*w) + w->priv.size); \
244-
ctx->tplg_offset += sizeof(*w) + w->priv.size; w; })
244+
(ctx)->tplg_offset += sizeof(*w) + w->priv.size; w; })
245245

246246
#define tplg_get_graph(ctx) \
247247
({struct snd_soc_tplg_dapm_graph_elem *w; \
248248
tplg_check_bounds(ctx, sizeof(*w)); \
249-
w = (struct snd_soc_tplg_dapm_graph_elem *)(ctx->tplg_base + ctx->tplg_offset); \
250-
ctx->tplg_offset += sizeof(*w); w; })
249+
w = (struct snd_soc_tplg_dapm_graph_elem *)((ctx)->tplg_base + (ctx)->tplg_offset); \
250+
(ctx)->tplg_offset += sizeof(*w); w; })
251251

252252
#define tplg_get_pcm(ctx) \
253253
({struct snd_soc_tplg_pcm *pcm; \
254254
tplg_check_bounds(ctx, sizeof(*pcm)); \
255-
pcm = (struct snd_soc_tplg_pcm *)(ctx->tplg_base + ctx->tplg_offset); \
255+
pcm = (struct snd_soc_tplg_pcm *)((ctx)->tplg_base + (ctx)->tplg_offset); \
256256
tplg_check_bounds(ctx, sizeof(*pcm) + pcm->priv.size); \
257-
ctx->tplg_offset += sizeof(*pcm) + pcm->priv.size; pcm; })
257+
(ctx)->tplg_offset += sizeof(*pcm) + pcm->priv.size; pcm; })
258258

259259
static inline int tplg_valid_widget(struct snd_soc_tplg_dapm_widget *widget)
260260
{

0 commit comments

Comments
 (0)