diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/fan.py index 57e163469a..b67f6acea6 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/fan.py @@ -71,8 +71,7 @@ class Fan(FanBase): self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex]) self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET self.fan_direction_offset = PSU_FAN_DIRECTION_OFFSET - self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + self.max_speed = 0 def get_name(self): """ @@ -163,11 +162,14 @@ class Fan(FanBase): int: percentage of the max fan speed """ if self.max_speed == 0: - self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset,2) + if not is_valid: + return 0 + self.max_speed = max_speed[1] + self.max_speed = max_speed[1] << 8 | max_speed[0] is_valid, fan_speed = self.speed_sensor.get_reading() if not is_valid or self.max_speed == 0: - return None + speed = 0 else: speed = (100 * fan_speed)//self.max_speed return speed diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/fan.py index c634dc7d0d..2b37bd3783 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/fan.py @@ -69,8 +69,7 @@ class Fan(FanBase): self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex]) self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET self.fan_direction_offset = PSU_FAN_DIRECTION_OFFSET - self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + self.max_speed = 0 def get_name(self): """ @@ -163,8 +162,11 @@ class Fan(FanBase): int: percentage of the max fan speed """ if self.max_speed == 0: - self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset,2) + if not is_valid: + return 0 + self.max_speed = max_speed[1] + self.max_speed = max_speed[1] << 8 | max_speed[0] is_valid, fan_speed = self.speed_sensor.get_reading() if not is_valid or self.max_speed == 0: speed = 0 diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/fan.py index 55327d5ddf..a9b0fcc4b2 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/fan.py @@ -71,8 +71,7 @@ class Fan(FanBase): self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex]) self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET self.fan_direction_offset = PSU_FAN_DIRECTION_OFFSET - self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + self.max_speed = 0 def get_name(self): """ @@ -165,11 +164,14 @@ class Fan(FanBase): int: percentage of the max fan speed """ if self.max_speed == 0: - self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset,2) + if not is_valid: + return 0 + self.max_speed = max_speed[1] + self.max_speed = max_speed[1] << 8 | max_speed[0] is_valid, fan_speed = self.speed_sensor.get_reading() if not is_valid or self.max_speed == 0: - return None + speed = 0 else: speed = (100 * fan_speed)//self.max_speed return speed diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/fan.py index b7d990877d..f9dacc94d9 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/fan.py @@ -71,8 +71,7 @@ class Fan(FanBase): self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex]) self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET self.fan_direction_offset = PSU_FAN_DIRECTION_OFFSET - self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + self.max_speed = 0 def get_name(self): """ @@ -165,8 +164,11 @@ class Fan(FanBase): int: percentage of the max fan speed """ if self.max_speed == 0: - self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset,2) + if not is_valid: + return 0 + self.max_speed = max_speed[1] + self.max_speed = max_speed[1] << 8 | max_speed[0] is_valid, fan_speed = self.speed_sensor.get_reading() if not is_valid or self.max_speed == 0: speed = 0 diff --git a/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/fan.py index b95b4d070a..a928d559cb 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/fan.py @@ -165,8 +165,11 @@ class Fan(FanBase): int: percentage of the max fan speed """ if self.max_speed == 0: - self.max_speed = self.fru.get_fru_data(self.max_speed_offset, 2)[1] - self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset, 2) + if not is_valid: + return 0 + self.max_speed = max_speed[1] + self.max_speed = max_speed[1] << 8 | max_speed[0] is_valid, fan_speed = self.speed_sensor.get_reading() if not is_valid or self.max_speed == 0: return None