Programmingkid <programmingk...@gmail.com> 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.