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>
This commit is contained in:
Tim Wawrzynczak 2021-09-14 11:54:47 -06:00 committed by Nico Huber
parent d47946e750
commit 35730389ef
1 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include <acpi/acpigen.h> #include <acpi/acpigen.h>
#include <assert.h>
#include <console/console.h> #include <console/console.h>
#include <intelblocks/acpi.h> #include <intelblocks/acpi.h>
#include <intelblocks/pmc_ipc.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, static void read_pmc_lpm_requirements(const struct soc_pmc_lpm *lpm,
struct reg_info *info) struct reg_info *info)
{ {
assert(info);
if (!CONFIG(SOC_INTEL_COMMON_BLOCK_ACPI_PEP_LPM_REQ) || !lpm) { if (!CONFIG(SOC_INTEL_COMMON_BLOCK_ACPI_PEP_LPM_REQ) || !lpm) {
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
return; 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->addr = (uint8_t *)reg;
info->buffer_size = register_count * sizeof(uint32_t); info->buffer_size = register_count * sizeof(uint32_t);
}
} }
/* /*