Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inc/fastrpc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ int fastrpc_session_open(int domain, int *dev);
/**
* @brief closes the remote session/file descriptor of the fastrpc device node
*/
int fastrpc_session_close(int domain);
void fastrpc_session_close(int domain, int dev);
/**
* @brief increments the reference count of the domain
* used to identify whether there are any active remote calls for a specific domain
Expand Down
16 changes: 11 additions & 5 deletions src/fastrpc_apps_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,18 @@ int fastrpc_session_open(int domain, int *dev) {
return AEE_ECONNREFUSED;
}

int fastrpc_session_close(int domain) {
int dev = hlist[domain].dev;

if (dev >= 0)
void fastrpc_session_close(int domain, int dev) {
if (!hlist)
return;
if ((hlist[domain].dev == INVALID_DEVICE) &&
(dev != INVALID_DEVICE)) {
close(dev);
return 0;
} else if ((hlist[domain].dev != INVALID_DEVICE) &&
(dev == INVALID_DEVICE)) {
close(hlist[domain].dev);
hlist[domain].dev = INVALID_DEVICE;
}
return;
}

int fastrpc_session_get(int domain) {
Expand Down
2 changes: 1 addition & 1 deletion src/fastrpc_cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int fastrpc_get_cap(uint32_t domain, uint32_t attributeID, uint32_t *capability)

bail:
if(dev != -1)
fastrpc_session_close(dom);
fastrpc_session_close(dom, dev);
if (nErr) {
FARF(ERROR, "Warning 0x%x: %s failed to get attribute %u for domain %u (errno %s)", nErr, __func__, attributeID, domain, strerror(errno));
}
Expand Down
2 changes: 1 addition & 1 deletion src/fastrpc_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static int fastrpc_context_deinit(fastrpc_context *ctx) {
if (!ctx->devs[i])
continue;

fastrpc_session_close(domain);
fastrpc_session_close(domain, INVALID_DEVICE);
}
free(ctx->devs);

Expand Down
Loading