aboutsummaryrefslogtreecommitdiff
path: root/lib/pci.c
diff options
context:
space:
mode:
authorswapnili <swapnil.ingle@nutanix.com>2021-02-10 17:54:51 +0100
committerGitHub <noreply@github.com>2021-02-10 17:54:51 +0100
commitaa2157aad1876c3963efe34c694c93eadd309c97 (patch)
treea232b4ef5155eacb7a902603a20ec358e38cdee4 /lib/pci.c
parentd3651f5d30a0532f39da962b9e76ba8cbada6e6c (diff)
downloadlibvfio-user-aa2157aad1876c3963efe34c694c93eadd309c97.zip
libvfio-user-aa2157aad1876c3963efe34c694c93eadd309c97.tar.gz
libvfio-user-aa2157aad1876c3963efe34c694c93eadd309c97.tar.bz2
API error return converged to one func (#325)
* API error return converged to one func Use ERROR_INT() or ERROR_PTR() to return errors from API's. This way if we want to change the behaviour later, we will just need to update these funcitons. Also fixed some error return cases and comments. Reviewed-by: John Levon <john.levon@nutanix.com>
Diffstat (limited to 'lib/pci.c')
-rw-r--r--lib/pci.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pci.c b/lib/pci.c
index 78ae459..8d40acb 100644
--- a/lib/pci.c
+++ b/lib/pci.c
@@ -418,12 +418,12 @@ vfu_pci_init(vfu_ctx_t *vfu_ctx, vfu_pci_type_t pci_type,
break;
default:
vfu_log(vfu_ctx, LOG_ERR, "invalid PCI type %u", pci_type);
- return ERROR(EINVAL);
+ return ERROR_INT(EINVAL);
}
if (hdr_type != PCI_HEADER_TYPE_NORMAL) {
vfu_log(vfu_ctx, LOG_ERR, "invalid PCI header type %d", hdr_type);
- return ERROR(EINVAL);
+ return ERROR_INT(EINVAL);
}
/*
@@ -433,13 +433,13 @@ vfu_pci_init(vfu_ctx_t *vfu_ctx, vfu_pci_type_t pci_type,
if (vfu_ctx->pci.config_space != NULL) {
vfu_log(vfu_ctx, LOG_ERR,
"PCI configuration space header already setup");
- return ERROR(EEXIST);
+ return ERROR_INT(EEXIST);
}
// Allocate a buffer for the config space.
cfg_space = calloc(1, size);
if (cfg_space == NULL) {
- return ERROR(ENOMEM);
+ return ERROR_INT(ENOMEM);
}
vfu_ctx->pci.type = pci_type;