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
This commit is contained in:
Ori Messinger
2023-02-02 14:27:02 -05:00
parent 142dcfa8f4
commit 56f9d6bfc0
+3 -1
View File
@@ -2069,7 +2069,9 @@ def showProductName(deviceList):
device_sku = vbios.value.decode().split('-')[1]
else:
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:
printLog(device, 'Incompatible device.\n' \
'GPU[%s]\t\t: Expected vendor name: Advanced Micro Devices, Inc. [AMD/ATI]\n' \