Skip to content

Commit

Permalink
Verbose validation of presenceSysfsPath and presenceGpio
Browse files Browse the repository at this point in the history
Summary:
Expect only one of presence method used.

TODO: Some duplicate thrift structs with PlatformManager. We should consolidate them.

Reviewed By: somasun

Differential Revision: D62783987

fbshipit-source-id: b27de893468623a45d274fa2f8a5382a94722d69
  • Loading branch information
Justin Kim authored and facebook-github-bot committed Sep 17, 2024
1 parent 9308906 commit 7b6ff58
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fboss/platform/fan_service/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ bool Utils::isValidConfig(const FanServiceConfig& config) {
XLOG(ERR) << "ledSysfsPath cannot be empty";
return false;
}
if ((!fan.presenceSysfsPath()) && (!fan.presenceGpio())) {
XLOG(ERR) << "either presenceSysfsPath or presenceGpio must be set";
if (fan.presenceSysfsPath() && fan.presenceGpio()) {
XLOG(ERR) << "Both presenceSysfsPath and presenceGpio cannot be set";
return false;
}
if (!fan.presenceSysfsPath() && !fan.presenceGpio()) {
XLOG(ERR) << "Either presenceSysfsPath or presenceGpio must be set";
return false;
}
}
Expand Down

0 comments on commit 7b6ff58

Please sign in to comment.