[Skiboot] [PATCH 03/15] FSP/LED: Continue processing LED update request in error path

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Mar 20 23:06:15 AEDT 2015


Presently if fsp_msg_set_led_state() fails then we don't continue
processing remaining LED update request...which is not correct.

Also free spcn_cmd in one place rather than freeing at every failure
block.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hw/fsp/fsp-leds.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index a569925..6852706 100644
--- a/hw/fsp/fsp-leds.c
+++ b/hw/fsp/fsp-leds.c
@@ -374,7 +374,6 @@ static int fsp_msg_set_led_state(struct led_set_cmd *spcn_cmd)
 						 OPAL_INTERNAL_ERROR);
 
 		unlock(&led_lock);
-		free(spcn_cmd);
 		return rc;
 	}
 
@@ -428,7 +427,6 @@ static int fsp_msg_set_led_state(struct led_set_cmd *spcn_cmd)
 	msg = fsp_mkmsg(FSP_CMD_SPCN_PASSTHRU, 4,
 			SPCN_ADDR_MODE_CEC_NODE, cmd_hdr, 0, PSI_DMA_LED_BUF);
 	if (!msg) {
-		free(spcn_cmd);
 		cmd |= FSP_STATUS_GENERIC_ERROR;
 		rc = -1;
 		goto update_fail;
@@ -445,7 +443,6 @@ static int fsp_msg_set_led_state(struct led_set_cmd *spcn_cmd)
 	if (rc != OPAL_SUCCESS) {
 		cmd |= FSP_STATUS_GENERIC_ERROR;
 		fsp_freemsg(msg);
-		free(spcn_cmd);
 		/* Revert LED state update */
 		update_led_list(spcn_cmd->loc_code, spcn_cmd->ckpt_status,
 				spcn_cmd->ckpt_excl_bit);
@@ -496,7 +493,12 @@ static int process_led_state_change(void)
 	spcn_cmd = list_pop(&spcn_cmdq, struct led_set_cmd, link);
 	unlock(&spcn_cmd_lock);
 
-	fsp_msg_set_led_state(spcn_cmd);
+	rc = fsp_msg_set_led_state(spcn_cmd);
+	if (rc) {
+		free(spcn_cmd);
+		process_led_state_change();
+	}
+
 	return rc;
 }
 



More information about the Skiboot mailing list