[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] qdev: qdev_unplug(): Use error_set()
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] qdev: qdev_unplug(): Use error_set() |
Date: |
Thu, 29 Mar 2012 14:45:38 +0100 |
On Thu, Mar 29, 2012 at 2:15 PM, Luiz Capitulino <address@hidden> wrote:
> On Thu, 29 Mar 2012 08:00:15 +0100
> Stefan Hajnoczi <address@hidden> wrote:
>
>> On Wed, Mar 28, 2012 at 05:50:53PM -0300, Luiz Capitulino wrote:
>> > @@ -268,7 +270,14 @@ static int pci_device_hot_remove(Monitor *mon, const
>> > char *pci_addr)
>> > monitor_printf(mon, "slot %d empty\n", slot);
>> > return -1;
>> > }
>> > - return qdev_unplug(&d->qdev);
>> > +
>> > + ret = qdev_unplug(&d->qdev, &errp);
>> > + if (error_is_set(&errp)) {
>> > + monitor_printf(mon, "%s\n", error_get_pretty(errp));
>> > + error_free(errp);
>> > + }
>>
>> Minor thing if you respin: this if statement could be replaced with
>> hmp_handle_error(mon, &errp).
>
> I'm not sure I'd like to see hmp_handle_error() spread over the tree. It uses
> the monitor object and I've added it just because having the same code
> duplicated among HMP functions bothered me... I think it's better to
> restrict it to hmp.c.
Okay. I mentioned it because I noticed that there are several
different ways to do essentially the same thing.
Stefan