Patchwork target-i386: Report on error during cpu_x86_register().

login
register
mail settings
Submitter Don Slutz
Date Sept. 1, 2012, 8:47 p.m.
Message ID <1346532470-15859-1-git-send-email-Don@CloudSwitch.com>
Download mbox | patch
Permalink /patch/181153/
State New
Headers show

Comments

Don Slutz - Sept. 1, 2012, 8:47 p.m.
Send it to stderr before free of the details.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Blue Swirl - Sept. 2, 2012, 10:54 a.m.
On Sat, Sep 1, 2012 at 8:47 PM, Don Slutz <Don@cloudswitch.com> wrote:
> Send it to stderr before free of the details.
>
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 57c064f..5c0fef1 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1352,6 +1352,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
>      }
>      object_property_set_str(OBJECT(cpu), def->model_id, "model-id", &error);
>      if (error_is_set(&error)) {
> +        fprintf(stderr, "%s: %s\n", __FUNCTION__, error_get_pretty(error));

__func__ is preferred by checkpatch.pl and also GCC recommends using it:
http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html

>          error_free(error);
>          return -1;
>      }
> --
> 1.7.1
>
>
Don Slutz - Sept. 2, 2012, 11:40 p.m.
Blue Swirl wrote:
> On Sat, Sep 1, 2012 at 8:47 PM, Don Slutz <Don@cloudswitch.com> wrote:
>   
>> Send it to stderr before free of the details.
>>
>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>> ---
>>  target-i386/cpu.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>> index 57c064f..5c0fef1 100644
>> --- a/target-i386/cpu.c
>> +++ b/target-i386/cpu.c
>> @@ -1352,6 +1352,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
>>      }
>>      object_property_set_str(OBJECT(cpu), def->model_id, "model-id", &error);
>>      if (error_is_set(&error)) {
>> +        fprintf(stderr, "%s: %s\n", __FUNCTION__, error_get_pretty(error));
>>     
>
> __func__ is preferred by checkpatch.pl and also GCC recommends using it:
> http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html
>
>   
>>          error_free(error);
>>          return -1;
>>      }
>> --
>> 1.7.1
>>
>>
>>     
Somehow I forgot to run checkpatch.pl on this.  V2 soon.
   -Don

Patch

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 57c064f..5c0fef1 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1352,6 +1352,7 @@  int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
     }
     object_property_set_str(OBJECT(cpu), def->model_id, "model-id", &error);
     if (error_is_set(&error)) {
+        fprintf(stderr, "%s: %s\n", __FUNCTION__, error_get_pretty(error));
         error_free(error);
         return -1;
     }