drbd: conn_send_cmd2(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 7f2afb8..018c336 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -769,21 +769,17 @@
 		   size_t size)
 {
 	struct p_header80 h;
-	int ok;
+	int err;
 
 	prepare_header80(&h, cmd, size);
-
-	if (drbd_get_data_sock(tconn))
-		return 0;
-
-	ok = (sizeof(h) ==
-		drbd_send(tconn, tconn->data.socket, &h, sizeof(h), 0));
-	ok = ok && (size ==
-		drbd_send(tconn, tconn->data.socket, data, size, 0));
-
-	drbd_put_data_sock(tconn);
-
-	return ok;
+	err = drbd_get_data_sock(tconn);
+	if (!err) {
+		err = drbd_send_all(tconn, tconn->data.socket, &h, sizeof(h), 0);
+		if (!err)
+			err = drbd_send_all(tconn, tconn->data.socket, data, size, 0);
+		drbd_put_data_sock(tconn);
+	}
+	return err;
 }
 
 int drbd_send_sync_param(struct drbd_conf *mdev)
@@ -882,7 +878,7 @@
 	if (tconn->agreed_pro_version >= 87)
 		strcpy(p->integrity_alg, tconn->net_conf->integrity_alg);
 
-	rv = conn_send_cmd2(tconn, P_PROTOCOL, p->head.payload, size - sizeof(struct p_header));
+	rv = !conn_send_cmd2(tconn, P_PROTOCOL, p->head.payload, size - sizeof(struct p_header));
 	kfree(p);
 	return rv;
 }