[Skiboot] [PATCH 2/2] Enable warn_unused_result for fsp_fetch_data_queue()

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Wed Dec 10 03:22:45 AEDT 2014


fsp_fetch_data_queue() internally calls fsp_queue_msg().
So ideally we should consume the result of this function.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hw/fsp/fsp-codeupdate.c |   29 +++++++++++++++++++++--------
 include/fsp.h           |    2 +-
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/hw/fsp/fsp-codeupdate.c b/hw/fsp/fsp-codeupdate.c
index 4f1a6a5..0d50f0c 100644
--- a/hw/fsp/fsp-codeupdate.c
+++ b/hw/fsp/fsp-codeupdate.c
@@ -304,6 +304,7 @@ static void fetch_lid_data_complete(struct fsp_msg *msg)
 	uint32_t lid_id, offset;
 	uint16_t id;
 	uint8_t flags, status;
+	int rc;
 
 	status = (msg->resp->word1 >> 8) & 0xff;
 	flags = (msg->data.words[0] >> 16) & 0xff;
@@ -327,10 +328,16 @@ static void fetch_lid_data_complete(struct fsp_msg *msg)
 		chunk = MARKER_LID_SIZE - offset;
 		if (chunk > 0) {
 			buffer = (void *)PSI_DMA_CODE_UPD + offset;
-			fsp_fetch_data_queue(flags, id, lid_id,
-					     offset, buffer, &chunk,
-					     fetch_lid_data_complete);
-			return;
+			rc = fsp_fetch_data_queue(flags, id, lid_id,
+						  offset, buffer, &chunk,
+						  fetch_lid_data_complete);
+
+			/* If queue msg fails, then continue with marker LID
+			 * validation hoping that we have at least boot side
+			 * information.
+			 */
+			if (rc == OPAL_SUCCESS)
+				return;
 		}
 		break;
 	default:	/* Fetch LID call failed */
@@ -341,10 +348,16 @@ static void fetch_lid_data_complete(struct fsp_msg *msg)
 	if (lid_id == P_COM_MARKER_LID_ID &&
 	    lid_fetch_side == FETCH_BOTH_SIDE) {
 		length = MARKER_LID_SIZE;
-		fsp_fetch_data_queue(flags, id, T_COM_MARKER_LID_ID,
-				     0, (void *)PSI_DMA_CODE_UPD,
-				     &length, fetch_lid_data_complete);
-		return;
+		rc = fsp_fetch_data_queue(flags, id, T_COM_MARKER_LID_ID,
+					  0, (void *)PSI_DMA_CODE_UPD,
+					  &length, fetch_lid_data_complete);
+
+		/* If queue msg fails, then continue with marker LID
+		 * validation hoping that we have at least boot side
+		 * information.
+		 */
+		if (rc == OPAL_SUCCESS)
+			return;
 	}
 
 	lock(&flash_lock);
diff --git a/include/fsp.h b/include/fsp.h
index dccc78c..ead1680 100644
--- a/include/fsp.h
+++ b/include/fsp.h
@@ -708,7 +708,7 @@ extern int fsp_fetch_data(uint8_t flags, uint16_t id, uint32_t sub_id,
 			  uint32_t offset, void *buffer, size_t *length);
 extern int fsp_fetch_data_queue(uint8_t flags, uint16_t id, uint32_t sub_id,
 				uint32_t offset, void *buffer, size_t *length,
-				void (*comp)(struct fsp_msg *msg));
+				void (*comp)(struct fsp_msg *msg)) __warn_unused_result;
 extern bool fsp_load_resource(enum resource_id id, void *buf, size_t *size);
 
 /* FSP console stuff */



More information about the Skiboot mailing list