diff options
author | Rizwan Qureshi <rizwan.qureshi@intel.com> | 2017-10-04 18:53:19 +0530 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-10-05 17:47:02 +0000 |
commit | 7f72c641957344e05176b7f31b0fffca434f4be7 (patch) | |
tree | 27bc06dbae2fe35cfea7c68f7f6cc89941704ad5 /src/soc/intel/apollolake | |
parent | b3e18c7a434700ace381443a0e16718d8c6af7f6 (diff) | |
download | coreboot-7f72c641957344e05176b7f31b0fffca434f4be7.tar.xz |
soc/intel/{common,apollolake}: Add checks to handle negative values
Fix issues reported by coverity scan in the below files.
src/soc/intel/common/block/i2c
1375440: Improper use of negative value
1375441: Improper use of negative value
1375444: Improper use of negative value
src/soc/intel/apollolake/i2c.c
1375442: Unsigned compared against 0
Change-Id: Ic65400c934631e3dcd3aa664c24cb451616e7f4d
Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Reviewed-on: https://review.coreboot.org/21875
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/intel/apollolake')
-rw-r--r-- | src/soc/intel/apollolake/i2c.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/soc/intel/apollolake/i2c.c b/src/soc/intel/apollolake/i2c.c index 2b6cbf95b2..4ae500ecce 100644 --- a/src/soc/intel/apollolake/i2c.c +++ b/src/soc/intel/apollolake/i2c.c @@ -44,7 +44,7 @@ uintptr_t i2c_get_soc_early_base(unsigned int bus) /* Convert I2C bus number to PCI device and function */ int i2c_soc_bus_to_devfn(unsigned int bus) { - if (bus >= 0 && bus <= 3) + if (bus <= 3) return PCI_DEVFN(PCH_DEV_SLOT_SIO1, bus); else if (bus >= 4 && bus <= 7) return PCI_DEVFN(PCH_DEV_SLOT_SIO2, (bus - 4)); |