diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2021-09-14 11:54:47 -0600 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-09-16 09:40:30 +0000 |
commit | 35730389ef94fd9882ca6d30c5c1669a23e05627 (patch) | |
tree | 3c47b80b02604d0ea22bc6d242e903cc3da3d8bb /src/soc/intel/common | |
parent | d47946e7506f5c919b7a7be78c1f6df110691397 (diff) |
soc/intel/common: Make read_pmc_lpm_requirements more clear
Commit 2eb100dd12 added PMC LPM requirements to the the PEP ACPI
objects, but it was not made clear that one of the pointer arguments to
the mentioned function is not supposed to be NULL and Coverity
complained. Make the intention clear by instead asserting that `info`
cannot be NULL.
Fixes: Coverity CID 1462119
Change-Id: I9e8862a100d92f4a7ed1826d3970a5110b47f4c4
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57645
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r-- | src/soc/intel/common/block/acpi/pep.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/soc/intel/common/block/acpi/pep.c b/src/soc/intel/common/block/acpi/pep.c index b8e7e0d033..fe38a36775 100644 --- a/src/soc/intel/common/block/acpi/pep.c +++ b/src/soc/intel/common/block/acpi/pep.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include <acpi/acpigen.h> +#include <assert.h> #include <console/console.h> #include <intelblocks/acpi.h> #include <intelblocks/pmc_ipc.h> @@ -27,6 +28,8 @@ struct reg_info { static void read_pmc_lpm_requirements(const struct soc_pmc_lpm *lpm, struct reg_info *info) { + assert(info); + if (!CONFIG(SOC_INTEL_COMMON_BLOCK_ACPI_PEP_LPM_REQ) || !lpm) { memset(info, 0, sizeof(*info)); return; @@ -61,10 +64,8 @@ static void read_pmc_lpm_requirements(const struct soc_pmc_lpm *lpm, } } - if (info) { - info->addr = (uint8_t *)reg; - info->buffer_size = register_count * sizeof(uint32_t); - } + info->addr = (uint8_t *)reg; + info->buffer_size = register_count * sizeof(uint32_t); } /* |