Skip to content

Commit

Permalink
Fixed the string check to avoid checking for None and just use boolea…
Browse files Browse the repository at this point in the history
…n logic.

This is required since there was a change in initialization which changed the default value from None to <empty string>.

Signed-off-by: Sathish Sekar <[email protected]>
  • Loading branch information
Sathish Sekar committed Apr 9, 2024
1 parent ead866b commit 77938ab
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 77938ab

Please sign in to comment.