[PATCH] xen/cache-col: address MISRA C Rule 5.3

Dmytro Prokopchuk1 posted 1 patch 3 days, 21 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/ded7e2aeecd18109bf2fde5cff0d356932f08e28.1773952245.git.dmytro._5Fprokopchuk1@epam.com
xen/common/llc-coloring.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] xen/cache-col: address MISRA C Rule 5.3
Posted by Dmytro Prokopchuk1 3 days, 21 hours ago
MISRA C:2012 Rule 5.3 states as following: An identifier declared in an
inner scope shall not hide an identifier declared in an outer scope.

Inside the 'if' block, the inner 'i' shadows the outer 'i'.
Reuse the outer variable and remove the inner declaration to fix that.

No functional change.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
---
 xen/common/llc-coloring.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 77a54beed1..822a6b2ed5 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -193,8 +193,6 @@ void __init llc_coloring_init(void)
 
     if ( !xen_num_colors )
     {
-        unsigned int i;
-
         xen_num_colors = MIN(XEN_DEFAULT_NUM_COLORS, max_nr_colors);
 
         printk(XENLOG_WARNING
-- 
2.43.0
Re: [PATCH] xen/cache-col: address MISRA C Rule 5.3
Posted by Jan Beulich 3 days, 11 hours ago
On 19.03.2026 21:31, Dmytro Prokopchuk1 wrote:
> MISRA C:2012 Rule 5.3 states as following: An identifier declared in an
> inner scope shall not hide an identifier declared in an outer scope.
> 
> Inside the 'if' block, the inner 'i' shadows the outer 'i'.
> Reuse the outer variable and remove the inner declaration to fix that.
> 
> No functional change.
> 
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>

Acked-by: Jan Beulich <jbeulich@suse.com>