summaryrefslogtreecommitdiffstats
path: root/binding/iiodevices-binding.c
diff options
context:
space:
mode:
Diffstat (limited to 'binding/iiodevices-binding.c')
-rw-r--r--binding/iiodevices-binding.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/binding/iiodevices-binding.c b/binding/iiodevices-binding.c
index d2d1ae4..f39ec6d 100644
--- a/binding/iiodevices-binding.c
+++ b/binding/iiodevices-binding.c
@@ -71,8 +71,6 @@ static struct event *events = 0;
static struct iio_context *ctx = NULL;
/*clients*/
static struct client_sub * clients = NULL;
-/*save last registered client*/
-static struct client_sub * last_client = NULL;
/* Static definition of supported iiodevices */
static struct iio_info iio_infos[] = {
@@ -504,9 +502,10 @@ static struct client_sub *add_new_client(struct iio_info *infos,
client->index = 0;
}
else {
- if(!last_client) {
- AFB_API_ERROR(afbBindingV3root, "last_client should not be null");
- return NULL;
+ //find last client
+ struct client_sub * last_client = clients;
+ while(last_client->next!=NULL) {
+ last_client = last_client->next;
}
last_client->next = client;
client->index = last_client->index + 1;
@@ -526,7 +525,6 @@ static struct client_sub *add_new_client(struct iio_info *infos,
client->dev = NULL;
client->event = event_add(event_name);
- last_client = client;
return client;
}