summaryrefslogtreecommitdiff
path: root/src/soc/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel')
-rw-r--r--src/soc/intel/common/block/gpio/gpio.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c
index d12281f74d..baf0e168b8 100644
--- a/src/soc/intel/common/block/gpio/gpio.c
+++ b/src/soc/intel/common/block/gpio/gpio.c
@@ -331,11 +331,23 @@ static const int mask[4] = {
static void gpio_configure_pad(const struct pad_config *cfg)
{
- const struct pad_community *comm = gpio_get_community(cfg->pad);
+ const struct pad_community *comm;
uint16_t config_offset;
uint32_t pad_conf, soc_pad_conf;
int i, pin, group;
+ if (!cfg) {
+ printk(BIOS_ERR, "%s: cfg value is NULL\n", __func__);
+ return;
+ }
+
+ comm = gpio_get_community(cfg->pad);
+ if (!comm) {
+ printk(BIOS_ERR, "%s: Could not find community for pad: 0x%x\n",
+ __func__, cfg->pad);
+ return;
+ }
+
config_offset = pad_config_offset(comm, cfg->pad);
pin = relative_pad_in_comm(comm, cfg->pad);
group = gpio_group_index(comm, pin);