summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/acpi_device.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/arch/x86/acpi_device.c b/src/arch/x86/acpi_device.c
index 5d8777f37f..57fbc89064 100644
--- a/src/arch/x86/acpi_device.c
+++ b/src/arch/x86/acpi_device.c
@@ -740,6 +740,9 @@ size_t acpi_dp_add_property_list(struct acpi_dp *dp,
const struct acpi_dp *prop;
size_t i, properties_added = 0;
+ if (!dp || !property_list)
+ return 0;
+
for (i = 0; i < property_count; i++) {
prop = &property_list[i];
@@ -775,6 +778,9 @@ size_t acpi_dp_add_property_list(struct acpi_dp *dp,
struct acpi_dp *acpi_dp_add_integer(struct acpi_dp *dp, const char *name,
uint64_t value)
{
+ if (!dp)
+ return NULL;
+
struct acpi_dp *new = acpi_dp_new(dp, ACPI_DP_TYPE_INTEGER, name);
if (new)
@@ -786,6 +792,9 @@ struct acpi_dp *acpi_dp_add_integer(struct acpi_dp *dp, const char *name,
struct acpi_dp *acpi_dp_add_string(struct acpi_dp *dp, const char *name,
const char *string)
{
+ if (!dp)
+ return NULL;
+
struct acpi_dp *new = acpi_dp_new(dp, ACPI_DP_TYPE_STRING, name);
if (new)
@@ -797,6 +806,9 @@ struct acpi_dp *acpi_dp_add_string(struct acpi_dp *dp, const char *name,
struct acpi_dp *acpi_dp_add_reference(struct acpi_dp *dp, const char *name,
const char *reference)
{
+ if (!dp)
+ return NULL;
+
struct acpi_dp *new = acpi_dp_new(dp, ACPI_DP_TYPE_REFERENCE, name);
if (new)
@@ -810,7 +822,7 @@ struct acpi_dp *acpi_dp_add_child(struct acpi_dp *dp, const char *name,
{
struct acpi_dp *new;
- if (!child || child->type != ACPI_DP_TYPE_TABLE)
+ if (!dp || !child || child->type != ACPI_DP_TYPE_TABLE)
return NULL;
new = acpi_dp_new(dp, ACPI_DP_TYPE_CHILD, name);
@@ -826,7 +838,7 @@ struct acpi_dp *acpi_dp_add_array(struct acpi_dp *dp, struct acpi_dp *array)
{
struct acpi_dp *new;
- if (!array || array->type != ACPI_DP_TYPE_TABLE)
+ if (!dp || !array || array->type != ACPI_DP_TYPE_TABLE)
return NULL;
new = acpi_dp_new(dp, ACPI_DP_TYPE_ARRAY, array->name);
@@ -842,7 +854,7 @@ struct acpi_dp *acpi_dp_add_integer_array(struct acpi_dp *dp, const char *name,
struct acpi_dp *dp_array;
int i;
- if (len <= 0)
+ if (!dp || len <= 0)
return NULL;
dp_array = acpi_dp_new_table(name);
@@ -862,6 +874,9 @@ struct acpi_dp *acpi_dp_add_gpio(struct acpi_dp *dp, const char *name,
const char *ref, int index, int pin,
int active_low)
{
+ if (!dp)
+ return NULL;
+
struct acpi_dp *gpio = acpi_dp_new_table(name);
if (!gpio)