[Skiboot] [PATCH 1/5] libflash/mbox-flash: Minor fixups before V2

Cyril Bur cyril.bur at au1.ibm.com
Mon Apr 24 19:14:07 AEST 2017


- Warn if flushing with closed write window.
- Call msg_free_memory() in mbox_flash_init() before a successful
  return. No leak is present as the current allocation theme is from
  static memory. However as this is likely to change in the future,
  best to ensure that msg_free_memory() is called after every
  allocation.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 libflash/mbox-flash.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index 7bf731d0..5244c35c 100644
--- a/libflash/mbox-flash.c
+++ b/libflash/mbox-flash.c
@@ -231,6 +231,9 @@ static int mbox_flash_flush(struct mbox_flash_data *mbox_flash, uint64_t pos,
 	struct bmc_mbox_msg *msg;
 	int rc;
 
+	if (!mbox_flash->write.open)
+		prlog(PR_WARNING, "Attempting to flush without an open write window\n");
+
 	msg = msg_alloc(mbox_flash, MBOX_C_WRITE_FLUSH);
 	if (!msg)
 		return FLASH_ERR_MALLOC_FAILED;
@@ -550,6 +553,8 @@ int mbox_flash_init(struct blocklevel_device **bl)
 		goto out_msg;
 	}
 
+	msg_free_memory(msg);
+
 	mbox_flash->bl.keep_alive = 0;
 	mbox_flash->bl.read = &mbox_flash_read;
 	mbox_flash->bl.write = &mbox_flash_write;
-- 
2.12.2



More information about the Skiboot mailing list