On Wed, 17 Sep 2025 13:51:58 +0200 Markus Armbruster <arm...@redhat.com> wrote:
> Functions that use an Error **errp parameter to return errors should > not also report them to the user, because reporting is the caller's > job. When the caller does, the error is reported twice. When it > doesn't (because it recovered from the error), there is no error to > report, i.e. the report is bogus. > > cxl_fmws_link_targets() violates this principle: it calls > error_setg(&error_fatal, ...) via cxl_fmws_link(). Goes back to > commit 584f722eb3ab (hw/cxl: Make the CXL fixed memory windows > devices.) Currently harmless, because cxl_fmws_link_targets()'s > callers always pass &error_fatal. Clean this up by converting > cxl_fmws_link() to Error. > > Also change its return value on error from 1 to -1 to conform to the > rules laid in qapi/error.h. It's call chain cxl_fmws_link_targets() > via object_child_foreach_recursive() is fine with that. > > Cc: Jonathan Cameron <jonathan.came...@huawei.com> > Signed-off-by: Markus Armbruster <arm...@redhat.com> > Reviewed-by: Jonathan Cameron <jonathan.came...@huawei.com> > Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org> LGTM with the updated commit message. Thanks! Jonathan