diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index e7874a65896..39d5c871fcb 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -507,6 +507,11 @@ def _read_eeprom(self, offset, num_bytes, log_on_error=True): Returns: bytearray: the content of EEPROM """ + presence_sysfs = f'/sys/module/sx_core/asic0/module{self.sdk_index}/hw_present' if self.is_sw_control() else f'/sys/module/sx_core/asic0/module{self.sdk_index}/present' + if utils.read_int_from_file(presence_sysfs) != 1: + logger.log_info(f'Failed attempt to read EEPROM for sfp={self.sdk_index}: No module connected') + return None + result = bytearray(0) while num_bytes > 0: _, page, page_offset = self._get_page_and_page_offset(offset)