return -1;
}
-static bool decode_header(struct drbd_tconn *tconn, struct p_header *h, struct packet_info *pi)
+static int decode_header(struct drbd_tconn *tconn, struct p_header *h, struct packet_info *pi)
{
if (h->h80.magic == cpu_to_be32(DRBD_MAGIC)) {
pi->cmd = be16_to_cpu(h->h80.command);
be32_to_cpu(h->h80.magic),
be16_to_cpu(h->h80.command),
be16_to_cpu(h->h80.length));
- return false;
+ return -EINVAL;
}
- return true;
+ return 0;
}
static int drbd_recv_header(struct drbd_tconn *tconn, struct packet_info *pi)
return false;
}
- r = decode_header(tconn, h, pi);
+ r = !decode_header(tconn, h, pi);
tconn->last_received = jiffies;
return r;
}
if (received == expect && cmd == NULL) {
- if (!decode_header(tconn, h, &pi))
+ if (decode_header(tconn, h, &pi))
goto reconnect;
cmd = &asender_tbl[pi.cmd];
if (pi.cmd >= ARRAY_SIZE(asender_tbl) || !cmd) {