From a08475e9abe48393453560a7bdd9ffc040be7845 Mon Sep 17 00:00:00 2001 From: Bora Guvendik Date: Fri, 5 Oct 2018 12:33:53 -0700 Subject: [PATCH] soc/intel/common/block/gpio: check for NULL using if statement Remove assert() and instead use if statement to check if comm->groups is NULL. Found-by: klockwork BUG=None TEST=Boot to OS Change-Id: I85a6bc700b52d04c61ca8f2baac62000f40cf2cb Signed-off-by: Bora Guvendik Reviewed-on: https://review.coreboot.org/28940 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Furquan Shaikh --- src/soc/intel/common/block/gpio/gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c index 931fb7f545..bd124775b6 100644 --- a/src/soc/intel/common/block/gpio/gpio.c +++ b/src/soc/intel/common/block/gpio/gpio.c @@ -73,7 +73,8 @@ static inline size_t gpio_group_index(const struct pad_community *comm, { size_t i; - assert(comm->groups != NULL); + if (!comm->groups) + die("Failed to get comm->groups."); /* find the base pad number for this pad's group */ for (i = 0; i < comm->num_groups; i++) {