From: Wenkai Lin linwenkai6@hisilicon.com
wd_recv_sync should print more information when return.
Signed-off-by: Wenkai Lin linwenkai6@hisilicon.com --- v1/wd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/v1/wd.c b/v1/wd.c index 4286bbe..02bc49c 100644 --- a/v1/wd.c +++ b/v1/wd.c @@ -688,8 +688,10 @@ int wd_wait(struct wd_queue *q, __u16 ms) fds[0].events = POLLIN;
ret = poll(fds, 1, ms); - if (unlikely(ret < 0)) + if (unlikely(ret < 0)) { + WD_ERR("failed to poll a queue!\n"); return -WD_ENODEV; + }
/* return 0 for no data, 1 for new message */ return ret; @@ -700,8 +702,11 @@ int wd_recv_sync(struct wd_queue *q, void **resp, __u16 ms) int ret;
ret = wd_wait(q, ms); - if (likely(ret > 0)) - return wd_recv(q, resp); + if (likely(ret > 0)) { + ret = wd_recv(q, resp); + if (unlikely(!ret)) + WD_ERR("failed to recv data after poll!\n"); + }
return ret; }