Received: from eggs.gnu.org ([2001:4830:134:3::10]:58972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxjI-0006Lb-SP for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:01:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZxjB-0004i4-Ei for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:01:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxjB-0004hl-AK for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:01:09 -0400 From: Markus Armbruster References: <0FB3A50B-7B60-4AB8-8BE0-DA40AC91692E@gmail.com> Date: Thu, 10 Sep 2015 11:01:06 +0200 In-Reply-To: <0FB3A50B-7B60-4AB8-8BE0-DA40AC91692E@gmail.com> (Programmingkid's message of "Wed, 9 Sep 2015 23:08:46 -0400") Message-ID: <87si6mzm0d.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] qmp_device_add() ret_data argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Programmingkid Cc: Peter Maydell , qemu-devel qemu-devel Programmingkid writes: > What does the function qmp_device_add() have a ret_data argument if it > isn't used? This function is located in qdev-monitor.c. QMP command handlers all implement the same interface: void (*cmd_new)(QDict *params, QObject **ret_data, Error **errp); Handlers of commands returning a value store the value to *ret_data. Handlers of commands not returning a value (such as device_add) leave ret_data alone. We could require them to store NULL, but that would be easy to forget, and usually catastrophic, so we don't.