core: fix pointer access in msgb_l[1-4] macros

Put the 'm' pointer into braces, so that it's possible to pass an
expression to these macros, e.g. a pointer-to-pointer dereference.

This patch makes the following example compile:

  struct msgb **msg = /* ... */;
  return msgb_l2(*msg); /* <-- currently this fails */

Currently it fails with the following error:

 error: ‘msg’ is a pointer to pointer; did you mean to
        dereference it before applying ‘->’ to it?

Change-Id: I2d19ea3c09ff9499314255d408fb71c07148fe25
This commit is contained in:
Vadim Yanitskiy 2023-07-08 00:05:41 +07:00 committed by fixeria
parent c87c6a3a73
commit 918b0ceb6f
1 changed files with 4 additions and 4 deletions

View File

@ -127,13 +127,13 @@ static inline struct msgb *msgb_dequeue_count(struct llist_head *queue,
#endif
/*! obtain L1 header of msgb */
#define msgb_l1(m) ((void *)(m->l1h))
#define msgb_l1(m) ((void *)((m)->l1h))
/*! obtain L2 header of msgb */
#define msgb_l2(m) ((void *)(m->l2h))
#define msgb_l2(m) ((void *)((m)->l2h))
/*! obtain L3 header of msgb */
#define msgb_l3(m) ((void *)(m->l3h))
#define msgb_l3(m) ((void *)((m)->l3h))
/*! obtain L4 header of msgb */
#define msgb_l4(m) ((void *)(m->l4h))
#define msgb_l4(m) ((void *)((m)->l4h))
/*! obtain SMS header of msgb */
#define msgb_sms(m) msgb_l4(m)