[XEN PATCH] xen/emul-i8254: address a violation of MISRA C:2012 Rule 8.3

Federico Serafini posted 1 patch 7 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/be245ab9b3805cdb1ba93695b95eeab24d432d6a.1695308350.git.federico.serafini@bugseng.com
xen/arch/x86/emul-i8254.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[XEN PATCH] xen/emul-i8254: address a violation of MISRA C:2012 Rule 8.3
Posted by Federico Serafini 7 months, 1 week ago
Make function declaration and definition consistent.
No fuctional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/arch/x86/emul-i8254.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/emul-i8254.c b/xen/arch/x86/emul-i8254.c
index 41ec4a1ef1..c48a3606a2 100644
--- a/xen/arch/x86/emul-i8254.c
+++ b/xen/arch/x86/emul-i8254.c
@@ -572,7 +572,7 @@ static uint32_t speaker_ioport_read(
 }
 
 static int cf_check handle_speaker_io(
-    int dir, unsigned int port, uint32_t bytes, uint32_t *val)
+    int dir, unsigned int port, unsigned int bytes, uint32_t *val)
 {
     struct PITState *vpit = vcpu_vpit(current);
 
-- 
2.34.1
Re: [XEN PATCH] xen/emul-i8254: address a violation of MISRA C:2012 Rule 8.3
Posted by Jan Beulich 7 months, 1 week ago
On 21.09.2023 17:05, Federico Serafini wrote:
> Make function declaration and definition consistent.
> No fuctional change.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> ---
>  xen/arch/x86/emul-i8254.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/arch/x86/emul-i8254.c b/xen/arch/x86/emul-i8254.c
> index 41ec4a1ef1..c48a3606a2 100644
> --- a/xen/arch/x86/emul-i8254.c
> +++ b/xen/arch/x86/emul-i8254.c
> @@ -572,7 +572,7 @@ static uint32_t speaker_ioport_read(
>  }
>  
>  static int cf_check handle_speaker_io(
> -    int dir, unsigned int port, uint32_t bytes, uint32_t *val)
> +    int dir, unsigned int port, unsigned int bytes, uint32_t *val)
>  {
>      struct PITState *vpit = vcpu_vpit(current);
>  

While okay-ish, could I talk you into addressing the problem at its root,
by eliminating the two forward declarations? Afaict all it takes is to
move pit_init() down past the two functions it takes the address of. (Of
course at that point it may want considering whether to keep
pit_{,de}init() and pit_reset() close together.)

Jan
Re: [XEN PATCH] xen/emul-i8254: address a violation of MISRA C:2012 Rule 8.3
Posted by Federico Serafini 7 months, 1 week ago
On 22/09/23 10:29, Jan Beulich wrote:
> On 21.09.2023 17:05, Federico Serafini wrote:
>> Make function declaration and definition consistent.
>> No fuctional change.
>>
>> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
>> ---
>>   xen/arch/x86/emul-i8254.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/x86/emul-i8254.c b/xen/arch/x86/emul-i8254.c
>> index 41ec4a1ef1..c48a3606a2 100644
>> --- a/xen/arch/x86/emul-i8254.c
>> +++ b/xen/arch/x86/emul-i8254.c
>> @@ -572,7 +572,7 @@ static uint32_t speaker_ioport_read(
>>   }
>>   
>>   static int cf_check handle_speaker_io(
>> -    int dir, unsigned int port, uint32_t bytes, uint32_t *val)
>> +    int dir, unsigned int port, unsigned int bytes, uint32_t *val)
>>   {
>>       struct PITState *vpit = vcpu_vpit(current);
>>   
> 
> While okay-ish, could I talk you into addressing the problem at its root,
> by eliminating the two forward declarations? Afaict all it takes is to
> move pit_init() down past the two functions it takes the address of. (Of
> course at that point it may want considering whether to keep
> pit_{,de}init() and pit_reset() close together.)
> 
> Jan
>

It seems to me a good alternative, I'll send a v2.

-- 
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)