[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220331102716.GL3293@kadam>
Date: Thu, 31 Mar 2022 13:27:17 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Alaa Mohamed <eng.alaamohamedsoliman.am@...il.com>
Cc: outreachy@...ts.linux.dev, gregkh@...uxfoundation.org,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: gdm724x: Fix Duplication of Side Effects
On Thu, Mar 31, 2022 at 12:18:49PM +0200, Alaa Mohamed wrote:
> Fix Duplication of Side Effects for GDM_TTY_READY(gdm) macro
> reported by checkpatch
> "CHECK: Macro argument reuse 'gdm' - possible side-effects?"
>
> Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@...il.com>
> ---
> drivers/staging/gdm724x/gdm_tty.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c
> index 04df6f9f5403..6f0274470e69 100644
> --- a/drivers/staging/gdm724x/gdm_tty.c
> +++ b/drivers/staging/gdm724x/gdm_tty.c
> @@ -27,7 +27,9 @@
>
> #define MUX_TX_MAX_SIZE 2048
>
> -#define GDM_TTY_READY(gdm) (gdm && gdm->tty_dev && gdm->port.count)
> +#define GDM_TTY_READY(_gdm) \
> + ({ typeof(_gdm) (gdm) = (_gdm); \
> + (gdm && gdm->tty_dev && gdm->port.count); })
The new macro is uglier. This is not a real bug and there is very
little chance it will become a bug in the future. So it's fine to leave
it as is.
Or another option would be to make it an inline function.
regards,
dan carpenter
Powered by blists - more mailing lists