All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Luca Fancellu <Luca.Fancellu@arm.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	michal.orzel@amd.com, xenia.ragiadakou@amd.com,
	ayan.kumar.halder@amd.com, consulting@bugseng.com,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Wei Liu <wl@xen.org>
Subject: Re: [XEN PATCH 2/2] xen/delay: address MISRA C:2012 Rule 5.3.
Date: Wed, 09 Aug 2023 16:09:31 +0200	[thread overview]
Message-ID: <dd2787dcd2c694141690fc71e5b811cb@bugseng.com> (raw)
In-Reply-To: <E970F516-F626-4F8A-8A82-DF3E31ABEA20@arm.com>

On 09/08/2023 15:56, Luca Fancellu wrote:
>> On 9 Aug 2023, at 08:55, Nicola Vetrini <nicola.vetrini@bugseng.com> 
>> wrote:
>> 
>> The variable 'msec' declared in the macro shadows the local
>> variable in 'ehci_dbgp_bios_handoff', but to prevent any
>> future clashes with other functions the macro is converted to
>> a static inline function.
>> 
>> No functional change.
>> 
>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
>> ---
>> xen/include/xen/delay.h | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>> 
>> diff --git a/xen/include/xen/delay.h b/xen/include/xen/delay.h
>> index 9d70ef035f..9150226271 100644
>> --- a/xen/include/xen/delay.h
>> +++ b/xen/include/xen/delay.h
>> @@ -4,7 +4,11 @@
>> /* Copyright (C) 1993 Linus Torvalds */
>> 
>> #include <asm/delay.h>
>> -#define mdelay(n) (\
>> - {unsigned long msec=(n); while (msec--) udelay(1000);})
>> +
>> +static inline void mdelay(unsigned long msec)
>> +{
>> +    while ( msec-- )
> 
> Does misra allows to modify the function parameters? (Truly asking 
> because IDK)
> 

I checked: there's an advisory (R17.8) that disallows this, but since 
advisories (apart from
a couple of selected ones) are not taken into consideration for 
compliance, so it's not a big deal.
Even less so since it's not a pointer type.

-- 
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)


      reply	other threads:[~2023-08-09 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09  7:55 [XEN PATCH 0/2] xen: address MISRA C:2012 Rule 5.3 Nicola Vetrini
2023-08-09  7:55 ` [XEN PATCH 1/2] x86/vmsi: rename variables to " Nicola Vetrini
2023-08-09 12:45   ` Jan Beulich
2023-08-10 15:27     ` Nicola Vetrini
2023-08-09  7:55 ` [XEN PATCH 2/2] xen/delay: " Nicola Vetrini
2023-08-09 11:10   ` Julien Grall
2023-08-09 13:56   ` Luca Fancellu
2023-08-09 14:09     ` Nicola Vetrini [this message]

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=dd2787dcd2c694141690fc71e5b811cb@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=Luca.Fancellu@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=consulting@bugseng.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xenia.ragiadakou@amd.com \
    /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.