From: Alif Zakuan Yuslaimi <alif.zakuan.yusla...@altera.com>

Initialize the actread variable to prevent undefined behavior
that can occur if the variable is used before being assigned a
value.

This will help to prevent potential issues, especially if
actread is used (e.g., read, incremented, or returned) before
being explicitly set elsewhere in the code.

Signed-off-by: Alif Zakuan Yuslaimi <alif.zakuan.yusla...@altera.com>
---
 drivers/misc/fs_loader.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
index 66803f4b997..cc07bfa7f14 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
  /*
  * Copyright (C) 2018-2019 Intel Corporation <www.intel.com>
+ * Copyright (C) 2025 Altera Corporation <www.altera.com>
  *
  */
 
@@ -148,7 +149,7 @@ static int _request_firmware_prepare(struct udevice *dev,
  */
 static int fw_get_filesystem_firmware(struct udevice *dev)
 {
-       loff_t actread;
+       loff_t actread = 0;
        char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;
        int ret;
 
-- 
2.35.3

Reply via email to