libftdi Archives

Subject: [PATCH 1/3] examples/async.c: fix sometimes-uninitialized warning

From: yegorslists@xxxxxxxxxxxxxx
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: thomas.jarosch@xxxxxxxxxxxxx, Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx>
Date: Wed, 4 Jun 2025 08:47:05 +0200
From: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx>

Initialize retval with EXIT_SUCCESS. Otherwise, if there are no errors,
this variable stays uninitialized.
---
 examples/async.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/async.c b/examples/async.c
index 241bb7f..4fc9631 100644
--- a/examples/async.c
+++ b/examples/async.c
@@ -30,7 +30,7 @@ int main(int argc, char **argv)
     struct ftdi_context *ftdi;
     int do_read = 0;
     int do_write = 0;
-    int i, f, retval;
+    int i, f, retval = EXIT_SUCCESS;
 
     if ((ftdi = ftdi_new()) == 0)
     {
-- 
2.34.1


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread