diff mbox

[04/15] FSP/LED: Validate before creating LED nodes

Message ID 20150320120620.29915.98751.stgit@localhost.localdomain
State Accepted
Headers show

Commit Message

Vasant Hegde March 20, 2015, 12:06 p.m. UTC
If FSP messes up SLCA data then attention location code points
to some other location code and its possible that we may endup
in duplicate LED location code :-(

Better to continue with partial LED list than crashing OPAL because
of duplicate node in device tree.

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

Comments

Stewart Smith March 26, 2015, 3:22 a.m. UTC | #1
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes:
> If FSP messes up SLCA data then attention location code points
> to some other location code and its possible that we may endup
> in duplicate LED location code :-(

Merged, with addition of prlog(PR_WARNING) so perhaps we find these
situations and can (eventually?) get them fixed.
Vasant Hegde March 31, 2015, 5:54 a.m. UTC | #2
On 03/26/2015 08:52 AM, Stewart Smith wrote:
> Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes:
>> If FSP messes up SLCA data then attention location code points
>> to some other location code and its possible that we may endup
>> in duplicate LED location code :-(
> 
> Merged, with addition of prlog(PR_WARNING) so perhaps we find these
> situations and can (eventually?) get them fixed.

Makes sense.. Thanks!

-Vasant
diff mbox

Patch

diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index 6852706..c4e7e39 100644
--- a/hw/fsp/fsp-leds.c
+++ b/hw/fsp/fsp-leds.c
@@ -1318,6 +1318,10 @@  void create_led_device_nodes(void)
 
 	/* LED child nodes */
 	list_for_each_safe(&cec_ledq, led, next, link) {
+		/* Duplicate LED location code */
+		if (dt_find_by_path(pled, led->loc_code))
+			continue;
+
 		cled = dt_new(pled, led->loc_code);
 		if (!cled) {
 			prlog(PR_WARNING, PREFIX