qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [Qemu-devel] [PATCH v1] pc-dimm: fix error messages if no


From: David Hildenbrand
Subject: Re: [Qemu-ppc] [Qemu-devel] [PATCH v1] pc-dimm: fix error messages if no slots were defined
Date: Thu, 26 Apr 2018 15:12:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 26.04.2018 13:41, Marcel Apfelbaum wrote:
> Hi David,
> 
> On 26/04/2018 13:34, David Hildenbrand wrote:
>> If not slots were defined we try to allocate an empty bitmap, which
> 
> not -> no
> 
>> fails.
>>
>> Signed-off-by: David Hildenbrand <address@hidden>
>> ---
>>
>> This fixes the queued patch "exec: Allow memory regions with size 0"
>>
>>  hw/mem/pc-dimm.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
>> index 0119c68e01..f2c140947d 100644
>> --- a/hw/mem/pc-dimm.c
>> +++ b/hw/mem/pc-dimm.c
>> @@ -118,9 +118,15 @@ static int pc_dimm_slot2bitmap(Object *obj, void 
>> *opaque)
>>  
>>  int pc_dimm_get_free_slot(const int *hint, int max_slots, Error **errp)
>>  {
>> -    unsigned long *bitmap = bitmap_new(max_slots);
>> +    unsigned long *bitmap;
>>      int slot = 0;
>>  
>> +    if (max_slots <= 0) {
>> +        error_setg(errp, "no free slots available");
> 
> Maybe a better error message would be "no slots were allocated"
> since max_slots is 0.

I am using the same error message as if there are no more slots
available. If can change it to "no slots where allocated, please specify
the 'slots' option.

Using max_slots would be wrong.

Thanks!

> 
> Thanks,
> Marcel
> 
>> +        return slot;
>> +    }
>> +
>> +    bitmap = bitmap_new(max_slots);
>>      object_child_foreach(qdev_get_machine(), pc_dimm_slot2bitmap, bitmap);
>>  
>>      /* check if requested slot is not occupied */
>>


-- 

Thanks,

David / dhildenb



reply via email to

[Prev in Thread] Current Thread [Next in Thread]