summaryrefslogtreecommitdiff
path: root/bin
diff options
authorMaciej Kisielewski <maciej.kisielewski@canonical.com>2018-05-04 16:37:35 +0200
committerMaciej Kisielewski <maciej.kisielewski@canonical.com>2018-05-04 20:27:21 +0200
commitd82a2cc916cdbc462206084be8b7d8e7928fe892 (patch)
treeded56fb241cc5d79a6442baac90800e31e47d39c /bin
parent869ba674ff6a45532f39f3d753f74b720849cbd9 (diff)
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 <maciej.kisielewski@canonical.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/removable_storage_test18
1 files changed, 4 insertions, 14 deletions
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