• A
    qdev: Fix qdev_try_create() semantics · 4ed658ca
    Andreas Färber 提交于
    Since QOM'ification, qdev_try_create() uses object_new() internally,
    which asserts "type != NULL" when the type is not registered.
    This was revealed by the combination of kvmclock's kvm_enabled() check
    and early QOM type registration.
    
    Check whether the class exists before calling object_new(), so that
    the caller (e.g., qdev_create) can fail gracefully, telling us which
    device could not be created.
    Signed-off-by: NAndreas Färber <afaerber@suse.de>
    Cc: Anthony Liguori <aliguori@codemonkey.ws>
    Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
    4ed658ca
qdev.c 17.4 KB