[PATCH] lpd: opal: call all get_indices() in opal_get_indicator_list()

Mauricio Faria de Oliveira <[email protected]> Thu, 17 Nov 2016 21:06:42 -0200
Newsgroups gmane.linux.tools.diag.devel
Message-ID <[email protected]>
Dont return early in opal_get_indicator_list() in case any of
the get_indices() call happens to fail.  Let's go through all
the calls to ensure any other pending/possible indicator that
can work still goes into the list.

Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
---
 lpd/indicator_opal.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/lpd/indicator_opal.c b/lpd/indicator_opal.c
index 712f57fea4e4..8a2003dc6696 100644
--- a/lpd/indicator_opal.c
+++ b/lpd/indicator_opal.c
@@ -423,27 +423,15 @@ opal_get_indicator_mode(void)
 static int
 opal_get_indicator_list(int indicator, struct loc_code **list)
 {
-	int	rc;
-
 	/*
 	 * We treat first indicator in fault indicator list as
 	 * check log indicator. Hence parse attention indicator.
 	 */
-	if (indicator == LED_TYPE_FAULT) {
-		rc = opal_get_indices(LED_TYPE_ATTN, list);
-		if (rc)
-			return rc;
-	}
+	if (indicator == LED_TYPE_FAULT)
+		opal_get_indices(LED_TYPE_ATTN, list);
 
 	/* Get OPAL indicator list */
-	rc = opal_get_indices(indicator, list);
-	if (rc)
-		return rc;
-
-	/* FRU fault indicators are not supported in Guiding Light mode */
-	if (indicator == LED_TYPE_FAULT &&
-	    operating_mode == LED_MODE_GUIDING_LIGHT)
-		return rc;
+	opal_get_indices(indicator, list);
 
 	/* SES indicators */
 	get_ses_indices(indicator, list);
@@ -451,7 +439,11 @@ opal_get_indicator_list(int indicator, struct loc_code **list)
 	/* Marvell HDD LEDs (indicators) */
 	get_mv_indices(indicator, list);
 
-	return rc;
+	/*
+	 * The list pointer (*list) is initially NULL.
+	 * If it's not-NULL here, we found indicators.
+	 */
+	return !(*list);
 }
 
 /**
-- 
1.8.3.1


------------------------------------------------------------------------------