lib/psos/task.c: fix build with gcc >= 12
PATCH 1/1 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
--- lib/psos/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/psos/task.c +2 -2
@@ -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);
Signature · 1 line
2.42.0
Quoted 39 lines · Fabrice Fontaine
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/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8aSigned-off-by Fabrice Fontaine <[email protected]>--- lib/psos/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/psos/task.c +1
-1@@ -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);
lib/psos/task.c u_long t_resume(u_long tid) · line 432
Quoted 8 lines
lib/psos/task.c +1
-1@@ -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);
Thanks for the report, but it looks to me more like get_psos_task should initialize *err_r to ERR_OBJDEL for the case that threadobj_lock() failed - which is hopefully what gcc found here.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center