From d82a2cc916cdbc462206084be8b7d8e7928fe892 Mon Sep 17 00:00:00 2001 From: Maciej Kisielewski Date: Fri, 4 May 2018 16:37:35 +0200 Subject: make forwarding xhci info easier It could be improved even further by introducing booleans instead of using 'xhci' as True value in the mapping of xhci support. Signed-off-by: Maciej Kisielewski --- bin/removable_storage_test | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'bin') diff --git a/bin/removable_storage_test b/bin/removable_storage_test index 42e197a..6de3f97 100755 --- a/bin/removable_storage_test +++ b/bin/removable_storage_test @@ -841,20 +841,10 @@ def main(): # This will raise KeyError for no # associated disk device was found. xhci_disks = test.get_disks_xhci() - # pep8 style suggest to limit the try clause - # to the absolute minimum amount of code necessary - try: - disk_xhci_flag = xhci_disks[disk] - except KeyError: - print("\t\tDisk does not use xhci_hci.") - return 1 - else: - if('xhci' == disk_xhci_flag): - print("\t\tDriver Detected: xhci_hcd") - else: - print("\t\tDisk does not use xhci_hci.") - logging.debug("disk_xhci_flag is not xhci") - return 1 + if test.get_disks_xhci().get(disk, '') != 'xhci': + raise SystemExit( + "\t\tDisk does not use xhci_hcd.") + print("\t\tDriver Detected: xhci_hcd") else: # Give it a hint for the detection failure. # LP: #1362902 -- cgit v1.2.3