ectool: Fix incorrect fan numbers from ectool

Return 0 if the board does not need fan indicated
by EC_FEATURE_PWM_FAN.

BRANCH=None
BUG=chrome-os-partner:55090
TEST=make buildall -j;
     in reef command "ectool pwmgetnumfans" returns 0

Change-Id: I7b59d266532622607c61fe3e7dd1bd0cc8ea9766
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/359069
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Divya Sasidharan
2016-07-08 10:03:58 -07:00
committed by chrome-bot
parent 14dbcb829e
commit 5df351f63c

View File

@@ -1688,6 +1688,14 @@ int cmd_thermal_set_threshold(int argc, char *argv[])
static int get_num_fans(void)
{
int idx, rv;
struct ec_response_get_features r;
rv = ec_command(EC_CMD_GET_FEATURES, 0, NULL, 0, &r, sizeof(r));
if (rv < 0)
return rv;
if (!(r.flags[0] & (1 << EC_FEATURE_PWM_FAN)))
return 0;
for (idx = 0; idx < EC_FAN_SPEED_ENTRIES; idx++) {
rv = read_mapped_mem16(EC_MEMMAP_FAN + 2 * idx);