qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] aspeed/i2c:fix uninitialized variable warning
@ 2020-02-06  4:07 kuhn.chenqun
  2020-02-06  8:21 ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: kuhn.chenqun @ 2020-02-06  4:07 UTC (permalink / raw)
  To: qemu-devel, clg, peter.maydell
  Cc: qemu-trivial, andrew, zhang.zhanghailiang, Chen Qun, joel

From: Chen Qun <kuhn.chenqun@huawei.com>

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 <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
 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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] aspeed/i2c:fix uninitialized variable warning
  2020-02-06  4:07 [PATCH] aspeed/i2c:fix uninitialized variable warning kuhn.chenqun
@ 2020-02-06  8:21 ` Thomas Huth
  2020-02-06  9:35   ` Laurent Vivier
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2020-02-06  8:21 UTC (permalink / raw)
  To: kuhn.chenqun, qemu-devel, clg, peter.maydell
  Cc: qemu-trivial, andrew, Miroslav Rezanina, zhang.zhanghailiang,
	joel

On 06/02/2020 05.07, kuhn.chenqun@huawei.com wrote:
> From: Chen Qun <kuhn.chenqun@huawei.com>
> 
> 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 <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
>  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)) {
> 

Thanks. Looks like the same patch that has been reported already here:

https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg04492.html

Could someone please pick this up (e.g. qemu-trivial?)?

 Thomas



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] aspeed/i2c:fix uninitialized variable warning
  2020-02-06  8:21 ` Thomas Huth
@ 2020-02-06  9:35   ` Laurent Vivier
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2020-02-06  9:35 UTC (permalink / raw)
  To: Thomas Huth, kuhn.chenqun, qemu-devel, clg, peter.maydell
  Cc: qemu-trivial, andrew, Miroslav Rezanina, zhang.zhanghailiang,
	joel

Le 06/02/2020 à 09:21, Thomas Huth a écrit :
> On 06/02/2020 05.07, kuhn.chenqun@huawei.com wrote:
>> From: Chen Qun <kuhn.chenqun@huawei.com>
>>
>> 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 <euler.robot@huawei.com>
>> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
>> ---
>>  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)) {
>>
> 
> Thanks. Looks like the same patch that has been reported already here:
> 
> https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg04492.html
> 
> Could someone please pick this up (e.g. qemu-trivial?)?

I will add the patch from Miroslav in my coming pull request.

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-06  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-06  4:07 [PATCH] aspeed/i2c:fix uninitialized variable warning kuhn.chenqun
2020-02-06  8:21 ` Thomas Huth
2020-02-06  9:35   ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).