package/xenomai: fix build with gcc >= 12

Fix the following build failure with gcc >= 12:

task.c: In function 't_start':
task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
  398 |         return ret;
      |                ^~~
task.c:364:13: note: 'ret' was declared here
  364 |         int ret;
      |             ^~~
task.c: In function 't_resume':
task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
  444 |         return ret;
      |                ^~~
task.c:428:13: note: 'ret' was declared here
  428 |         int ret;
      |             ^~~

Fixes:
 - http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Fabrice Fontaine 2023-12-03 15:54:18 +01:00 committed by Peter Korsgaard
parent f6a7050d71
commit a3db1dd1b7

View File

@ -0,0 +1,56 @@
From 6c6da9e6d75ccfaa83c1efe14211f080c14181c6 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sun, 3 Dec 2023 15:28:50 +0100
Subject: [PATCH] lib/psos/task.c: fix build with gcc >= 12
Fix the following build failure with gcc >= 12:
task.c: In function 't_start':
task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
398 | return ret;
| ^~~
task.c:364:13: note: 'ret' was declared here
364 | int ret;
| ^~~
task.c: In function 't_resume':
task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
444 | return ret;
| ^~~
task.c:428:13: note: 'ret' was declared here
428 | int ret;
| ^~~
Fixes:
- http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Upstream: https://lore.kernel.org/xenomai/20231203144307.1940139-1-fontaine.fabrice@gmail.com/T/#u
---
lib/psos/task.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/psos/task.c b/lib/psos/task.c
index f678be61d..27bcc28a9 100644
--- a/lib/psos/task.c
+++ b/lib/psos/task.c
@@ -362,7 +362,7 @@ u_long t_start(u_long tid,
{
struct psos_task *task;
struct service svc;
- int ret;
+ int ret = SUCCESS;
CANCEL_DEFER(svc);
@@ -426,7 +426,7 @@ u_long t_resume(u_long tid)
{
struct psos_task *task;
struct service svc;
- int ret;
+ int ret = SUCCESS;
CANCEL_DEFER(svc);
--
2.42.0