On 18/4/24 12:04, Zhao Liu wrote:
From: Zhao Liu <[email protected]>

As error.h suggested, the best practice for callee is to return
something to indicate success / failure.

With returned boolean, there's no need to dereference @errp to check
failure case.

Suggested-by: Markus Armbruster <[email protected]>
Signed-off-by: Zhao Liu <[email protected]>
---
  hw/cxl/cxl-cdat.c              | 6 +++---
  hw/mem/cxl_type3.c             | 3 +--
  hw/pci-bridge/cxl_upstream.c   | 3 +--
  include/hw/cxl/cxl_component.h | 2 +-
  4 files changed, 6 insertions(+), 8 deletions(-)


diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h
index 5012fab6f763..945ee6ffd045 100644
--- a/include/hw/cxl/cxl_component.h
+++ b/include/hw/cxl/cxl_component.h
@@ -273,7 +273,7 @@ hwaddr cxl_decode_ig(int ig);
  CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb);
  bool cxl_get_hb_passthrough(PCIHostState *hb);
-void cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp);
+bool cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp);
  void cxl_doe_cdat_release(CXLComponentState *cxl_cstate);
  void cxl_doe_cdat_update(CXLComponentState *cxl_cstate, Error **errp);

Another candidate ;)


Reply via email to