mb/google/nissa: Fix potential null pointer dereference

* Introduce a null check before calling `gpio_padbased_override`
  in `variant_configure_pads`.
* This prevents potential errors in cases where the
`variant_gpio_override_table` function returns a null pointer,
indicating that there are no override pads to configure.

BUG=b:334826281
TEST=Able to avoid hang incase there is no GPIO override.

Change-Id: I733210a08091b37eda6e6b0d6924aafd5e7e6280
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82628
Reviewed-by: Dinesh Gehlot <digehlot@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Subrata Banik 2024-05-24 01:33:52 +05:30
parent bfc92cb944
commit 2889787522

View File

@ -16,7 +16,8 @@ void variant_configure_pads(void)
base_pads = variant_gpio_table(&base_num);
gpio_padbased_override(padbased_table, base_pads, base_num);
override_pads = variant_gpio_override_table(&override_num);
gpio_padbased_override(padbased_table, override_pads, override_num);
if (override_pads != NULL)
gpio_padbased_override(padbased_table, override_pads, override_num);
fw_config_gpio_padbased_override(padbased_table);
gpio_configure_pads_with_padbased(padbased_table);
free(padbased_table);