diff mbox

[RFC,1/2] FSP: Introduce refcount variable in fsp_msg structure

Message ID 20150312112527.30440.95500.stgit@localhost.localdomain
State Rejected
Headers show

Commit Message

Vasant Hegde March 12, 2015, 11:25 a.m. UTC
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hw/fsp/fsp.c  |    2 ++
 include/fsp.h |    3 +++
 2 files changed, 5 insertions(+)
diff mbox

Patch

diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
index 2be79c7..215fd30 100644
--- a/hw/fsp/fsp.c
+++ b/hw/fsp/fsp.c
@@ -246,6 +246,8 @@  struct fsp_msg *fsp_allocmsg(bool alloc_response)
 
 void __fsp_freemsg(struct fsp_msg *msg)
 {
+	if (msg->refcount)
+		return;
 	free(msg);
 }
 
diff --git a/include/fsp.h b/include/fsp.h
index b796bfb..11469b3 100644
--- a/include/fsp.h
+++ b/include/fsp.h
@@ -598,6 +598,9 @@  struct fsp_msg {
 	/* Response will be filed by driver when response received */
 	struct fsp_msg		*resp;
 
+	/* Holds number of pending references */
+	int			refcount;
+
 	/* Internal queuing */
 	struct list_node	link;
 };