[6/6] Warn if value of qdev_init() isn't checked

Message ID a47c23cc3a4e9e2b7208524e3398738d280d539e.1252699478.git.armbru@redhat.com
State Superseded
Headers show

Commit Message

Markus Armbruster Sept. 11, 2009, 8:19 p.m.
After qdev_init() fails, the device is gone.  Failure to check runs a
high risk of use-after-free.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
 hw/qdev.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/hw/qdev.h b/hw/qdev.h
index e3245e3..3e2d271 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -89,7 +89,7 @@  struct CompatProperty {
 DeviceState *qdev_create(BusState *bus, const char *name);
 DeviceState *qdev_device_add(QemuOpts *opts);
-int qdev_init(DeviceState *dev);
+int qdev_init(DeviceState *dev) __attribute__((warn_unused_result));
 void qdev_init_nofail(DeviceState *dev);
 void qdev_free(DeviceState *dev);