All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xenia Ragiadakou <burzalodowa@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH 1/2] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 20.7 violation
Date: Wed, 27 Jul 2022 19:18:05 +0300	[thread overview]
Message-ID: <a5d21713-5b69-1476-70a1-d8d9212afd74@gmail.com> (raw)
In-Reply-To: <9db28ce4-d4dd-3806-75c7-a6746d40cbb4@suse.com>

Hi Jan,

On 7/27/22 18:36, Jan Beulich wrote:
> On 27.07.2022 17:32, Xenia Ragiadakou wrote:
>> The macro parameter 'p' is used as an expression and needs to be enclosed in
>> parentheses.
> 
> Yes, but ...
> 
>> --- a/xen/arch/arm/include/asm/atomic.h
>> +++ b/xen/arch/arm/include/asm/atomic.h
>> @@ -123,15 +123,15 @@ static always_inline void write_atomic_size(volatile void *p,
>>   }
>>   
>>   #define read_atomic(p) ({                                               \
>> -    union { typeof(*p) val; char c[0]; } x_;                            \
>> -    read_atomic_size(p, x_.c, sizeof(*p));                              \
>> +    union { typeof(*(p)) val; char c[0]; } x_;                          \
>> +    read_atomic_size((p), x_.c, sizeof(*(p)));                          \
> 
> ... not in the first argument's case - that's not an expression.
> Too few parentheses are a risk, but too many are as well, as they
> negatively affect readability.
> 

Yes you are right. Here
write_atomic_size((p), &x_, sizeof(*(p)));
as well.

I will fix and resend.

-- 
Xenia


  reply	other threads:[~2022-07-27 16:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 15:32 [PATCH 0/2] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule violations Xenia Ragiadakou
2022-07-27 15:32 ` [PATCH 1/2] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 20.7 violation Xenia Ragiadakou
2022-07-27 15:36   ` Jan Beulich
2022-07-27 16:18     ` Xenia Ragiadakou [this message]
2022-07-27 15:32 ` [PATCH 2/2] xen/arm: asm/atomic.h: Fix MISRA C 2012 Rule 2.5 violation Xenia Ragiadakou
2022-07-27 15:46   ` Julien Grall
2022-07-27 16:23     ` Xenia Ragiadakou
2022-07-28  7:57     ` Bertrand Marquis
2022-07-28  9:35       ` Julien Grall
2022-07-28  9:45         ` Bertrand Marquis
2022-07-28 10:21           ` Julien Grall
2022-07-28 10:26             ` Bertrand Marquis
2022-07-28 23:01               ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5d21713-5b69-1476-70a1-d8d9212afd74@gmail.com \
    --to=burzalodowa@gmail.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.