[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] aspeed/i2c:fix uninitialized variable warning
From: |
kuhn.chenqun |
Subject: |
[PATCH] aspeed/i2c:fix uninitialized variable warning |
Date: |
Thu, 6 Feb 2020 12:07:53 +0800 |
From: Chen Qun <address@hidden>
Fix warning:
hw/i2c/aspeed_i2c.c: In function ‘aspeed_i2c_bus_write’:
glib/glib-autocleanups.h:28:3: warning: ‘cmd_flags’ may be
used uninitialized in this function [-Wmaybe-uninitialized]
g_free (*pp);
^~~~~~~~~~~~
hw/i2c/aspeed_i2c.c:403:22: note: ‘cmd_flags’ was declared here
g_autofree char *cmd_flags;
^~~~~~~~~
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Chen Qun <address@hidden>
---
hw/i2c/aspeed_i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index 9cda968501..fb973a983d 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -400,7 +400,7 @@ static bool aspeed_i2c_check_sram(AspeedI2CBus *bus)
static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
{
- g_autofree char *cmd_flags;
+ g_autofree char *cmd_flags = NULL;
uint32_t count;
if (bus->cmd & (I2CD_RX_BUFF_ENABLE | I2CD_RX_BUFF_ENABLE)) {
--
2.23.0
- [PATCH] aspeed/i2c:fix uninitialized variable warning,
kuhn.chenqun <=