[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-acpi
Subject:    [PATCH] ACPI/HEST: avoid stack traces when encountering
From:       "Jan Beulich" <JBeulich () novell ! com>
Date:       2010-08-31 13:19:51
Message-ID: 4C7D1D9702000078000132F6 () vpn ! id2 ! novell ! com
[Download RAW message or body]

Rather than trying to create duplicate platform devices, check for
duplication up front.

Generally the kernel doesn't require uniqueness of the source IDs
other than for obtaining unique platform device names (and making log
message non-ambiguous) - therefore, it would be possible to simply
replace eventual duplicate IDs with kernel assigned ones.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

---
 drivers/acpi/apei/hest.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- linux-2.6.36-rc3/drivers/acpi/apei/hest.c
+++ 2.6.36-rc3-acpi-hest-duplicate-source/drivers/acpi/apei/hest.c
@@ -140,6 +140,7 @@ static int hest_parse_ghes(struct acpi_h
 	struct acpi_hest_generic *generic;
 	struct platform_device *ghes_dev;
 	struct ghes_arr *ghes_arr = data;
+	unsigned int i;
 	int rc;
 
 	if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
@@ -147,6 +148,17 @@ static int hest_parse_ghes(struct acpi_h
 	generic = (struct acpi_hest_generic *)hest_hdr;
 	if (!generic->enabled)
 		return 0;
+	for (i = 0; i < ghes_arr->count; ++i) {
+		const struct acpi_hest_generic *g;
+
+		g = ghes_arr->ghes_devs[i]->dev.platform_data;
+		if (hest_hdr->source_id == g->header.source_id) {
+			printk(KERN_WARNING
+			       "Duplicate generic error source ID %#x\n",
+			       hest_hdr->source_id);
+			return -EEXIST;
+		}
+	}
 	ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id);
 	if (!ghes_dev)
 		return -ENOMEM;



--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic