From 33938af707dbae1a341d2eecb801489f5938aa1b Mon Sep 17 00:00:00 2001 From: Alexandre Bailon <abailon@baylibre.com> Date: Tue, 20 Sep 2016 13:35:40 +0200 Subject: [PATCH] comtroller: exit the recv thread in the case of error When an error happen during a read operation, the thread continuously try to read again, and break down the performances. If something is going wrong during a read operation, exit the thread instead of trying to read again. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> --- controller.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/controller.c b/controller.c index a4d1022..403b9ca 100644 --- a/controller.c +++ b/controller.c @@ -265,7 +265,12 @@ void *connection_recv(void *data) ret = ctrl->read(conn, buffer, GB_NETLINK_MTU); if (ret < 0) { pr_err("Failed to read data: %d\n", ret); - continue; + break; + } + + if (ret == 0) { + pr_err("Read is expected to be blocking!\n"); + break; } pr_dump(buffer, ret); -- GitLab