diff mbox series

[XEN] xen/iommu_init: address a violation of MISRA C:2012 Rule 8.3

Message ID cfd803a27efaa529b4e972acc1fa6a8f0e20c9c0.1698155675.git.federico.serafini@bugseng.com (mailing list archive)
State New, archived
Headers show
Series [XEN] xen/iommu_init: address a violation of MISRA C:2012 Rule 8.3 | expand

Commit Message

Federico Serafini Oct. 24, 2023, 2:01 p.m. UTC
Change parameter name and emphasize that it is deliberately not used through a
comment followed by the statement '(void) data;'.
This also addresses a violation of MISRA C:2012 Rule 2.7 ("A function should
not contain unused parameters").

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/drivers/passthrough/amd/iommu_init.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Jan Beulich Oct. 24, 2023, 2:44 p.m. UTC | #1
On 24.10.2023 16:01, Federico Serafini wrote:
> --- a/xen/drivers/passthrough/amd/iommu_init.c
> +++ b/xen/drivers/passthrough/amd/iommu_init.c
> @@ -692,7 +692,7 @@ static void iommu_check_ppr_log(struct amd_iommu *iommu)
>      spin_unlock_irqrestore(&iommu->lock, flags);
>  }
>  
> -static void cf_check do_amd_iommu_irq(void *unused)
> +static void cf_check do_amd_iommu_irq(void *data)
>  {
>      struct amd_iommu *iommu;
>  
> @@ -702,6 +702,11 @@ static void cf_check do_amd_iommu_irq(void *unused)
>          return;
>      }
>  
> +    /*
> +     * Formal parameter is deliberately unused.
> +     */
> +    (void) data;

Besides me thinking that the original way of expressing things was more
clear (and still even machine-recognizable), there are (nit) also style
issues here: The comment is malformed and there shouldn't be a blank
between the cast operator and the expression it applies to.

Jan
diff mbox series

Patch

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 9c01a49435..5bfaa6cdd4 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -692,7 +692,7 @@  static void iommu_check_ppr_log(struct amd_iommu *iommu)
     spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-static void cf_check do_amd_iommu_irq(void *unused)
+static void cf_check do_amd_iommu_irq(void *data)
 {
     struct amd_iommu *iommu;
 
@@ -702,6 +702,11 @@  static void cf_check do_amd_iommu_irq(void *unused)
         return;
     }
 
+    /*
+     * Formal parameter is deliberately unused.
+     */
+    (void) data;
+
     /*
      * No matter from where the interrupt came from, check all the
      * IOMMUs present in the system. This allows for having just one