Skip to contentSkip to conversation

xen/common: device_tree: Fix MISRA C 2012 Rule 8.7 violation

PATCH In review Xenia Ragiadakou 3 participants 3 messages Jun 22, 2022 – Jun 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/common: device_tree: Fix MISRA C 2012 Rule 8.7 violation

The function __dt_n_size_cells() is referenced only in device_tree.c. Change the linkage of the function from external to internal by adding the storage-class specifier static to the function definition.

This patch aims to resolve indirectly a MISRA C 2012 Rule 8.4 violation warning.

---
 xen/common/device_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/device_tree.c +1 -1
index 0e8798bd24..6c9712ab7b 100644
@@ -496,7 +496,7 @@ static int __dt_n_addr_cells(const struct dt_device_node *np, bool_t parent)
     return DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
 }
 
-int __dt_n_size_cells(const struct dt_device_node *np, bool_t parent)
+static int __dt_n_size_cells(const struct dt_device_node *np, bool_t parent)
 {
     const __be32 *ip;
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Xenia Ragiadakou

The function __dt_n_size_cells() is referenced only in device_tree.c. Change the linkage of the function from external to internal by adding the storage-class specifier static to the function definition.

This patch aims to resolve indirectly a MISRA C 2012 Rule 8.4 violation warning.

Quoted 20 lines
---
 xen/common/device_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/device_tree.c +1 -1
index 0e8798bd24..6c9712ab7b 100644
@@ -496,7 +496,7 @@ static int __dt_n_addr_cells(const struct dt_device_node *np, bool_t parent)
     return DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
 }
 
-int __dt_n_size_cells(const struct dt_device_node *np, bool_t parent)
+static int __dt_n_size_cells(const struct dt_device_node *np, bool_t parent)
 {
     const __be32 *ip;
 
Signature · 1 line
2.34.1
#2 lore raw

Hi,

Quoted 11 lines · Stefano Stabellini
Quoted 8 lines · Xenia Ragiadakou

The function __dt_n_size_cells() is referenced only in device_tree.c. Change the linkage of the function from external to internal by adding the storage-class specifier static to the function definition.

This patch aims to resolve indirectly a MISRA C 2012 Rule 8.4 violation warning.

Committed.

Cheers,

Quoted 22 lines
Quoted 22 lines

---
  xen/common/device_tree.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/device_tree.c +1 -1
index 0e8798bd24..6c9712ab7b 100644
@@ -496,7 +496,7 @@ static int __dt_n_addr_cells(const struct dt_device_node *np, bool_t parent)
      return DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
  }
 
-int __dt_n_size_cells(const struct dt_device_node *np, bool_t parent)
+static int __dt_n_size_cells(const struct dt_device_node *np, bool_t parent)
  {
      const __be32 *ip;
 
Signature · 1 line
2.34.1
Signature · 1 line
Julien Grall