diff options
author | Eddie James <eajames@linux.ibm.com> | 2020-05-19 22:39:36 +0300 |
---|---|---|
committer | Joel Stanley <joel@jms.id.au> | 2020-08-06 03:30:34 +0300 |
commit | 9596468d511281ae9f2b0b998f953fd7bf3c4e83 (patch) | |
tree | 6737faaa3ec244f9dccd9a3ed91ac530d48fc5f6 /drivers | |
parent | 8103f8714a46b30d961bb450aaf6b08d1c552e5b (diff) | |
download | linux-9596468d511281ae9f2b0b998f953fd7bf3c4e83.tar.xz |
i2c: fsi: Prevent adding adapters for ports without dts nodes
Ports should be defined in the devicetree if they are to be enabled on
the system.
OpenBMC-Staging-Count: 3
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-fsi.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 977d6f524649..95b6b6bc1d78 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -703,7 +703,12 @@ static int fsi_i2c_probe(struct device *dev) for (port_no = 0; port_no < ports; port_no++) { np = fsi_i2c_find_port_of_node(dev->of_node, port_no); - if (np && !of_device_is_available(np)) + /* Do not add port if it is not described in the device tree */ + if (!np) + continue; + + /* Do not add port if it is described as disabled */ + if (!of_device_is_available(np)) continue; port = kzalloc(sizeof(*port), GFP_KERNEL); |