From 59f971d451fbabee3194bb565f40846398ee6e6f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 14 Feb 2012 10:19:53 +0100 Subject: qdev: print error message before aborting qdev_prop_set_* functions are always called by machine init functions that should know what they're doing, so they abort on error. Still, an assert(!errp) does not aid debugging. Print an error before aborting. Signed-off-by: Paolo Bonzini Signed-off-by: Blue Swirl --- qerror.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index 8e6efafe00..f55d435d11 100644 --- a/qerror.c +++ b/qerror.c @@ -572,6 +572,14 @@ void qerror_report_err(Error *err) } } +void assert_no_error(Error *err) +{ + if (err) { + qerror_report_err(err); + abort(); + } +} + /** * qobject_to_qerror(): Convert a QObject into a QError */ -- cgit 1.4.1