lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] staging: gdm724x: Fix Duplication of Side Effects
On Thu, Mar 31, 2022 at 10:29:04AM +0000, David Laight wrote:
> From: Alaa Mohamed
> > Sent: 31 March 2022 11:19
> >
> > 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@gmail.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); })
>
> Did you test this?
>
> see https://godbolt.org/z/cazPrrzPv
>

I don't understand the link. The patch should work as far as I can see.

regards,
dan carpenter

\
 
 \ /
  Last update: 2022-03-31 12:42    [W:0.086 / U:0.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site