From b221d594ded34b3063df5b5274ba50a19a2b58dd Mon Sep 17 00:00:00 2001 From: tshalvi Date: Thu, 5 Sep 2024 19:38:41 +0300 Subject: [PATCH] Added functionality to handle empty EEPROM files --- platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index 1a0245b79e62..e8f48bbe54aa 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -553,6 +553,9 @@ def _read_eeprom(self, offset, num_bytes, log_on_error=True): else: result += content read_length = len(content) + if read_length == 0: + logger.log_error(f'SFP {self.sdk_index}: EEPROM page {page} is empty, no data retrieved') + return None num_bytes -= read_length if num_bytes > 0: page_size = f.seek(0, os.SEEK_END)