common: i2c: Fix 'close()' may close invalid fd

If 'I2C_SLAVE_FORCE' fails, the "close()" will be called twice by the
"open()" and "~I2C()", and the "close()" doesn't check the 'fd' value
valid or not.

And "close()" should not be a valid const member function, chang it to
mark the 'fd' invalid if "::close()" is called.

Change-Id: Ibeb923c4e3ea400c2de630ff7223df56c349a941
Signed-off-by: Haiyue Wang <haiyuewa@163.com>
2 files changed
tree: 3a410da2b56f336b3f8ccb41bfad537a67695ff1
  1. bios/
  2. bmc/
  3. common/
  4. cpld/
  5. eeprom-device/
  6. i2c-vr/
  7. subprojects/
  8. test/
  9. tpm/
  10. .clang-format
  11. .clang-tidy
  12. .gitignore
  13. .shellcheck
  14. LICENSE
  15. meson.build
  16. meson.options
  17. OWNERS
  18. README.md
README.md

phosphor-bmc-code-mgmt

Phosphor BMC Code Management provides a set of system software management applications. More information can be found at Software Architecture

To Build

To build this package, do the following steps:

  1. meson build
  2. ninja -C build

To clean the repository run rm -r build.