diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2016-06-21 14:08:35 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-06-21 16:31:23 +1000 |
commit | 5f25590fd430265e69190aaa50f019e8dadad293 (patch) | |
tree | 43efdfa458efd75ed4bf8502483a8cc650584508 | |
parent | 0f23e5bd7987e9cedeadbad19e812b125dbd2cf5 (diff) | |
download | skiboot-5f25590fd430265e69190aaa50f019e8dadad293.zip skiboot-5f25590fd430265e69190aaa50f019e8dadad293.tar.gz skiboot-5f25590fd430265e69190aaa50f019e8dadad293.tar.bz2 |
platforms/ibm-fsp: Fix condition for valid slot
In firenze_pci_slot_init(), i2c_alloc_req() can return NULL though
it's very rare. We don't cover the case. If NULL I2C request returned
from the function, the I2C dependent power management won't be used.
This checks if i2c_alloc_req() returns valid I2C request or not.
Suggested-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | platforms/ibm-fsp/firenze-pci.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/platforms/ibm-fsp/firenze-pci.c b/platforms/ibm-fsp/firenze-pci.c index 4a9aff3..4416f1f 100644 --- a/platforms/ibm-fsp/firenze-pci.c +++ b/platforms/ibm-fsp/firenze-pci.c @@ -767,11 +767,12 @@ static void firenze_pci_slot_init(struct pci_slot *slot) plat_slot->i2c_bus = firenze_pci_find_i2c_bus(info->chip_id, info->master_id, info->port_id); - if (plat_slot->i2c_bus) { + if (plat_slot->i2c_bus) plat_slot->req = i2c_alloc_req(plat_slot->i2c_bus); - if (!plat_slot->req) - plat_slot->i2c_bus = NULL; + else + plat_slot->req = NULL; + if (plat_slot->req) { plat_slot->req->dev_addr = info->slave_addr; plat_slot->req->offset_bytes = 1; plat_slot->req->offset = 0x69; @@ -806,7 +807,7 @@ static void firenze_pci_slot_init(struct pci_slot *slot) * be utilized. To figure out power status retrival or * configuration after we have a blocking API for that. */ - if (plat_slot->i2c_bus) { + if (plat_slot->req) { slot->ops.freset = firenze_pci_slot_freset; slot->ops.get_power_state = firenze_pci_slot_get_power_state; slot->ops.set_power_state = firenze_pci_slot_set_power_state; |