Print mailbox error response data only if data_size > 0.
--- a/master/mailbox.c Tue May 03 14:13:11 2016 +0200
+++ b/master/mailbox.c Tue May 03 14:17:39 2016 +0200
@@ -178,6 +178,13 @@
return ERR_PTR(-EPROTO);
}
+#if 0
+ if (slave->master->debug_level) {
+ EC_SLAVE_DBG(slave, 1, "Mailbox data:\n");
+ ec_print_data(datagram->data, EC_MBOX_HEADER_SIZE + data_size);
+ }
+#endif
+
*type = EC_READ_U8(datagram->data + 5) & 0x0F;
*size = data_size;
@@ -195,11 +202,13 @@
break;
}
- if (!mbox_msg->code)
+ if (!mbox_msg->code) {
printk("Unknown error reply code 0x%04X.\n", code);
-
- if (slave->master->debug_level)
+ }
+
+ if (slave->master->debug_level && data_size > 0) {
ec_print_data(datagram->data + EC_MBOX_HEADER_SIZE, data_size);
+ }
return ERR_PTR(-EPROTO);
}