From: Paolo Bonzini <pbonzini@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
David Hildenbrand <david@redhat.com>,
qemu-devel@nongnu.org
Cc: Pankaj Gupta <pagupta@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
Marcel Apfelbaum <marcel@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2] pc-dimm: fix error messages if no slots were defined
Date: Wed, 2 May 2018 13:10:08 +0200 [thread overview]
Message-ID: <ebb3e2e0-5fe7-f059-1de6-f77ca9a6040c@redhat.com> (raw)
In-Reply-To: <1ecc2dc7-be06-c680-5f97-df0c8d6d4be0@redhat.com>
On 27/04/2018 18:25, Thomas Huth wrote:
> On 27.04.2018 14:05, David Hildenbrand wrote:
>> If no slots were defined we try to allocate an empty bitmap, which
>> fails.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>
>> v1 -> v2: more detailed error message
>>
>> hw/mem/pc-dimm.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
>> index 0119c68e01..12da89d562 100644
>> --- a/hw/mem/pc-dimm.c
>> +++ b/hw/mem/pc-dimm.c
>> @@ -118,9 +118,16 @@ 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 slots where allocated, please specify "
>> + "the 'slots' option");
>> + return slot;
>
> In case you respin, I'd maybe rather return -1 here.
>
> But since this is not used by the caller anyway in case of errors:
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
Queued, thanks all.
Paolo
prev parent reply other threads:[~2018-05-02 11:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 12:05 [Qemu-devel] [PATCH v2] pc-dimm: fix error messages if no slots were defined David Hildenbrand
2018-04-27 12:36 ` Marcel Apfelbaum
2018-04-27 16:25 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2018-05-02 11:10 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ebb3e2e0-5fe7-f059-1de6-f77ca9a6040c@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=pagupta@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).