qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/3] hw/cxl/cxl-cdat: Make cxl_doe_cdat_init() return boolean


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 3/3] hw/cxl/cxl-cdat: Make cxl_doe_cdat_init() return boolean
Date: Thu, 18 Apr 2024 14:06:15 +0200
User-agent: Mozilla Thunderbird

On 18/4/24 12:04, Zhao Liu wrote:
From: Zhao Liu <zhao1.liu@intel.com>

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 <armbru@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
  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

[Prev in Thread] Current Thread [Next in Thread]