[PATCH 4/4] Staging: ks7010: hostif: Fix multiple use of arguments in ps_confirm_wait_inc() macro.

From: Quytelda Kahja
Date: Fri Feb 16 2018 - 21:26:02 EST


Use GCC extensions to prevent macro arguments from accidentally being evaluated
multiple times when the macro is called.

Signed-off-by: Quytelda Kahja <quytelda@xxxxxxxxxxx>
---
drivers/staging/ks7010/ks_hostif.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 30c9592b3a00..92035e8ac843 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1306,11 +1306,10 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
return ret;
}

-#define ps_confirm_wait_inc(priv) \
- do { \
- if (atomic_read(&priv->psstatus.status) > PS_ACTIVE_SET) \
- atomic_inc(&priv->psstatus.confirm_wait); \
- } while (0)
+#define ps_confirm_wait_inc(priv) \
+ ({ typeof(priv) priv_ = (priv); \
+ if (atomic_read(&priv_->psstatus.status) > PS_ACTIVE_SET) \
+ atomic_inc(&priv_->psstatus.confirm_wait); })

static
void hostif_mib_get_request(struct ks_wlan_private *priv,
--
2.16.1