From patchwork Fri Mar 20 12:06:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 452611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 281AE1401AB for ; Fri, 20 Mar 2015 23:06:43 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id F112E1A2A96 for ; Fri, 20 Mar 2015 23:06:42 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e28smtp06.in.ibm.com (e28smtp06.in.ibm.com [122.248.162.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 9CA1B1A2A8C for ; Fri, 20 Mar 2015 23:06:39 +1100 (AEDT) Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Mar 2015 17:36:37 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 20 Mar 2015 17:36:34 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 5C78D1258056 for ; Fri, 20 Mar 2015 17:38:08 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay05.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2KC6Xim11337788 for ; Fri, 20 Mar 2015 17:36:33 +0530 Received: from d28av05.in.ibm.com (localhost [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t2KC6X1T029159 for ; Fri, 20 Mar 2015 17:36:33 +0530 Received: from localhost.localdomain ([9.124.35.34]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t2KC6X5W029141 for ; Fri, 20 Mar 2015 17:36:33 +0530 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 20 Mar 2015 17:36:33 +0530 Message-ID: <20150320120620.29915.98751.stgit@localhost.localdomain> In-Reply-To: <20150320114829.29915.11277.stgit@localhost.localdomain> References: <20150320114829.29915.11277.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15032012-0021-0000-0000-0000044A3812 Subject: [Skiboot] [PATCH 04/15] FSP/LED: Validate before creating LED nodes X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- hw/fsp/fsp-leds.c | 4 ++++ 1 file changed, 4 insertions(+) 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