[Skiboot] [PATCH] pau: Fix a build error with GCC 13.1.1

Vaibhav Jain vaibhav at linux.ibm.com
Mon Jul 10 19:43:11 AEST 2023


Compiling hmi.c with GCC 13.1.1 results in following error

core/hmi.c:860:25: error: ‘pau’ may be used uninitialized [-Werror=maybe-uninitialized]
  860 |                         pau_opencapi_dump_scoms(pau);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix this by initializing variable 'pau' with NULL when defined in
npu_fir_errors(). Variable 'pau' is only assigned/referenced in switch-case
blocks when phb_type == phb_type_pau_opencapi. Hence this patch shouldn't
introduce any behavioral changes.

Signed-off-by: Vaibhav Jain <vaibhav at linux.ibm.com>
---
 core/hmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/hmi.c b/core/hmi.c
index ce5abd7d6..dcb43afe0 100644
--- a/core/hmi.c
+++ b/core/hmi.c
@@ -774,7 +774,7 @@ static bool npu_fir_errors(struct phb *phb, int flat_chip_id,
 	struct npu *npu;
 	struct npu2 *npu2 = NULL;
 	struct npu2_dev *dev;
-	struct pau *pau;
+	struct pau *pau = NULL;
 
 	fir_regs = (phb->phb_type == phb_type_pcie_v3) ? 1 : 3;
 
-- 
2.41.0



More information about the Skiboot mailing list