ROCm SMI CLI: Fix --showproductname bug

This patch fixes a --showproductname bug, which is related to the
device's SKU. If a device with a VBIOS value that cannot be decoded
is used, that device's SKU cannot be parsed out of the VBIOS string.

Now, when the VBIOS value cannot be decoded, an error will be
printed instead of crashing with an 'UnboundLocalError' message.

Signed-off-by: Ori Messinger <Ori.Messinger@amd.com>
Change-Id: I680a182e94107e782235b8a2477ab165988f7703
Цей коміт міститься в:
Ori Messinger
2023-02-02 14:27:02 -05:00
джерело 142dcfa8f4
коміт 56f9d6bfc0
+3 -1
Переглянути файл
@@ -2069,7 +2069,9 @@ def showProductName(deviceList):
device_sku = vbios.value.decode().split('-')[1] device_sku = vbios.value.decode().split('-')[1]
else: else:
device_sku = 'unknown' device_sku = 'unknown'
printLog(device, 'Card SKU', '\t\t' + device_sku) printLog(device, 'Card SKU', '\t\t' + device_sku)
else:
printErrLog(device, "Unable to decode VBIOS value for device SKU")
else: else:
printLog(device, 'Incompatible device.\n' \ printLog(device, 'Incompatible device.\n' \
'GPU[%s]\t\t: Expected vendor name: Advanced Micro Devices, Inc. [AMD/ATI]\n' \ 'GPU[%s]\t\t: Expected vendor name: Advanced Micro Devices, Inc. [AMD/ATI]\n' \