[PATCH] include: linux/iopoll: fix uninitialized warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In gcc 13.3 there is a warning that start may be used unitialized:

  include/linux/iopoll.h:42:21: warning: ‘start’ may be used uninitialized [-Wmaybe-uninitialized]
     42 |                     is_timeout(start, ((timeout_us) * USECOND))) { \
        |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The warning is bogus since before usage of start !IN_PBL and
timeout_us != 0 are checked for the case where start is used, but in
this case it is also always initialized to get_time_ns().
Initialize it to zero to silence the warning.

Signed-off-by: Rouven Czerwinski <r.czerwinski@xxxxxxxxxxxxxx>
---
 include/linux/iopoll.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 96b17dee48..c7dcaec382 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -31,7 +31,7 @@
  */
 #define read_poll_timeout(op, val, cond, timeout_us, args...)	\
 ({ \
-	uint64_t start; \
+	uint64_t start = 0; \
 	if (!IN_PBL && (timeout_us) != 0) \
 		start = get_time_ns(); \
 	for (;;) { \
-- 
2.46.0





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux