Message ID | 20230710094312.1377015-1-vaibhav@linux.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | pau: Fix a build error with GCC 13.1.1 | expand |
On Mon, Jul 10, 2023 at 03:13:11PM +0530, Vaibhav Jain wrote: >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. Seems like this is a fairly recent update in f38 and rawhide. Thanks for the quick fix!
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;
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@linux.ibm.com> --- core/hmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)