[3/5] discover/platform-powerpc: return the actual mailbox size
diff mbox series

Message ID 20190626123156.GA16262@gmail.com
State Not Applicable, archived
Headers show
Series
  • Untitled series #116333
Related show

Commit Message

Maxim Polyakov June 26, 2019, 12:31 p.m. UTC
get_ipmi_boot_mailbox_block() should return the actual size
of the received IPMI mailbox data

Signed-off-by: Maxim Polyakov <m.polyakov@yadro.com>
---
 discover/platform-powerpc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index 1e33bf1..c874560 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -473,12 +473,7 @@  static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform,
 		return -1;
 	}
 
-	if (resp_len == 4) {
-		pb_debug_fn("block %hu empty\n", block);
-		return 0;
-	}
-
-	blocksize = sizeof(resp) - 4;
+	blocksize = resp_len - 4;
 	pb_debug_fn("Mailbox block %hu returns only %zu bytes in block\n",
 			block, blocksize);
 
@@ -512,6 +507,12 @@  static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform,
 		return -1;
 	}
 
+	if (!blocksize) {
+		pb_debug_fn("block %hu empty\n", block);
+		return 0;
+	}
+
+
 	memcpy(buf, &resp[4], blocksize);
 
 	return blocksize;