From 35730389ef94fd9882ca6d30c5c1669a23e05627 Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Tue, 14 Sep 2021 11:54:47 -0600 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57645 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Angel Pons Reviewed-by: Nico Huber --- src/soc/intel/common/block/acpi/pep.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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 +#include #include #include #include @@ -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); } /* -- cgit v1.2.3