diff mbox

[RFC,5/5] savevm: Replace error_report() & error_free() with error_report_err()

Message ID 1425114327-12136-6-git-send-email-zhang.zhanghailiang@huawei.com
State New
Headers show

Commit Message

Zhanghailiang Feb. 28, 2015, 9:05 a.m. UTC
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
 savevm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Markus Armbruster March 2, 2015, 10:26 a.m. UTC | #1
zhanghailiang <zhang.zhanghailiang@huawei.com> writes:

> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
>  savevm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/savevm.c b/savevm.c
> index ce2b6a2..c4f8c39 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -932,8 +932,7 @@ int qemu_loadvm_state(QEMUFile *f)
>      int ret;
>  
>      if (qemu_savevm_state_blocked(&local_err)) {
> -        error_report("%s", error_get_pretty(local_err));
> -        error_free(local_err);
> +        error_report_err(local_err);
>          return -EINVAL;
>      }

This one's good.  My commit 565f65d "error: Use error_report_err() where
appropriate" cleaned up this pattern, but a few more instances have
since crept in, and this is one.

I can see another one in hw/arm/virt.c machvirt_init().
Zhanghailiang March 3, 2015, 6:11 a.m. UTC | #2
On 2015/3/2 18:26, Markus Armbruster wrote:
> zhanghailiang <zhang.zhanghailiang@huawei.com> writes:
>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> ---
>>   savevm.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/savevm.c b/savevm.c
>> index ce2b6a2..c4f8c39 100644
>> --- a/savevm.c
>> +++ b/savevm.c
>> @@ -932,8 +932,7 @@ int qemu_loadvm_state(QEMUFile *f)
>>       int ret;
>>
>>       if (qemu_savevm_state_blocked(&local_err)) {
>> -        error_report("%s", error_get_pretty(local_err));
>> -        error_free(local_err);
>> +        error_report_err(local_err);
>>           return -EINVAL;
>>       }
>
> This one's good.  My commit 565f65d "error: Use error_report_err() where
> appropriate" cleaned up this pattern, but a few more instances have
> since crept in, and this is one.
>
> I can see another one in hw/arm/virt.c machvirt_init().
>
>

Er, do you mean the follow place ?

        /* Handle any CPU options specified by the user */
         cc->parse_features(CPU(cpuobj), cpustr[1], &err);
         if (err) {
             error_report("%s", error_get_pretty(err));
             exit(1);
         }
Markus Armbruster March 3, 2015, 9:19 a.m. UTC | #3
zhanghailiang <zhang.zhanghailiang@huawei.com> writes:

> On 2015/3/2 18:26, Markus Armbruster wrote:
>> zhanghailiang <zhang.zhanghailiang@huawei.com> writes:
>>
>>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>>> ---
>>>   savevm.c | 3 +--
>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/savevm.c b/savevm.c
>>> index ce2b6a2..c4f8c39 100644
>>> --- a/savevm.c
>>> +++ b/savevm.c
>>> @@ -932,8 +932,7 @@ int qemu_loadvm_state(QEMUFile *f)
>>>       int ret;
>>>
>>>       if (qemu_savevm_state_blocked(&local_err)) {
>>> -        error_report("%s", error_get_pretty(local_err));
>>> -        error_free(local_err);
>>> +        error_report_err(local_err);
>>>           return -EINVAL;
>>>       }
>>
>> This one's good.  My commit 565f65d "error: Use error_report_err() where
>> appropriate" cleaned up this pattern, but a few more instances have
>> since crept in, and this is one.
>>
>> I can see another one in hw/arm/virt.c machvirt_init().
>>
>>
>
> Er, do you mean the follow place ?
>
>        /* Handle any CPU options specified by the user */
>         cc->parse_features(CPU(cpuobj), cpustr[1], &err);
>         if (err) {
>             error_report("%s", error_get_pretty(err));
>             exit(1);
>         }

Yes.
Zhanghailiang March 3, 2015, 9:34 a.m. UTC | #4
On 2015/3/3 17:19, Markus Armbruster wrote:
> zhanghailiang <zhang.zhanghailiang@huawei.com> writes:
>
>> On 2015/3/2 18:26, Markus Armbruster wrote:
>>> zhanghailiang <zhang.zhanghailiang@huawei.com> writes:
>>>
>>>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>>>> ---
>>>>    savevm.c | 3 +--
>>>>    1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git a/savevm.c b/savevm.c
>>>> index ce2b6a2..c4f8c39 100644
>>>> --- a/savevm.c
>>>> +++ b/savevm.c
>>>> @@ -932,8 +932,7 @@ int qemu_loadvm_state(QEMUFile *f)
>>>>        int ret;
>>>>
>>>>        if (qemu_savevm_state_blocked(&local_err)) {
>>>> -        error_report("%s", error_get_pretty(local_err));
>>>> -        error_free(local_err);
>>>> +        error_report_err(local_err);
>>>>            return -EINVAL;
>>>>        }
>>>
>>> This one's good.  My commit 565f65d "error: Use error_report_err() where
>>> appropriate" cleaned up this pattern, but a few more instances have
>>> since crept in, and this is one.
>>>
>>> I can see another one in hw/arm/virt.c machvirt_init().
>>>
>>>
>>
>> Er, do you mean the follow place ?
>>
>>         /* Handle any CPU options specified by the user */
>>          cc->parse_features(CPU(cpuobj), cpustr[1], &err);
>>          if (err) {
>>              error_report("%s", error_get_pretty(err));
>>              exit(1);
>>          }
>
> Yes.

OK, i will send a patch fix these two places. Thanks. :)
diff mbox

Patch

diff --git a/savevm.c b/savevm.c
index ce2b6a2..c4f8c39 100644
--- a/savevm.c
+++ b/savevm.c
@@ -932,8 +932,7 @@  int qemu_loadvm_state(QEMUFile *f)
     int ret;
 
     if (qemu_savevm_state_blocked(&local_err)) {
-        error_report("%s", error_get_pretty(local_err));
-        error_free(local_err);
+        error_report_err(local_err);
         return -EINVAL;
     }