net/rpmsg: fix return value of rpmsg_sock_sendmsg()
authorSuman Anna <s-anna@ti.com>
Tue, 15 Jan 2019 21:41:25 +0000 (15:41 -0600)
committerSuman Anna <s-anna@ti.com>
Fri, 18 Jan 2019 16:52:12 +0000 (10:52 -0600)
The .sendmsg() proto ops should return a negative value upon
failure and the number of bytes transmitted on success. The
rpmsg_sock_sendmsg() is currently returning 0 on success,
which is incorrect. Fix this.

Fixes: 01b8b679d69d ("net/rpmsg: add support for new rpmsg sockets")
Signed-off-by: Suman Anna <s-anna@ti.com>
net/rpmsg/rpmsg_proto.c

index 02758b0c4761b763fc8bfa6e60646071c3597f6d..508907c7fbb63271dd3b5389e680ffb01309d2bd 100644 (file)
@@ -191,6 +191,8 @@ static int rpmsg_sock_sendmsg(struct socket *sock, struct msghdr *msg,
        err = rpmsg_send(rpsk->rpdev->ept, payload, len);
        if (err)
                pr_err("rpmsg_send failed: %d\n", err);
+       else
+               err = len;
 
 out:
        release_sock(sk);