Skip to content

Commit

Permalink
Merge pull request #18 from opencomputeproject/bugfix/handle-empty-st…
Browse files Browse the repository at this point in the history
…ring

Replaced the string check to use boolean instead of None
  • Loading branch information
sksekar authored Apr 10, 2024
2 parents 5b8c66b + 77938ab commit 2af67d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pci_lmt/pcie_lane_margining.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
def handle_lane_status(method: ty.Callable):
def wrapper(self: "PcieDeviceLaneMargining", lane: int, *args, **kwargs):
# Skip invoking the function if the device is faulty.
if self.device_error is not None:
if self.device_error:
return {"error": self.device_error}

# Skip invoking the function if the lane is already faulty.
# Return the first error encountered.
if self.lane_errors[lane] is not None:
if self.lane_errors[lane]:
return {"error": self.lane_errors[lane]}

# Invoke the function and update the lane_errors if the function failed.
ret = method(self, lane, *args, **kwargs)
if ret["error"] is not None:
if ret["error"]:
logger.warning(f"{method} failed for BDF {self.device.bdf} lane {lane}: {ret['error']}")
self.lane_errors[lane] = ret["error"]
return ret
Expand Down

0 comments on commit 2af67d7

Please sign in to comment.