Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CodeQl issues #180

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pitopd/pthub/pthub_spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ def communicate():
logger.error("Error transceiving SPI data from pi-topHUB. " + str(e))
logger.info(traceback.format_exc())
raise e
return False


def _main_thread_loop():
Expand Down
4 changes: 2 additions & 2 deletions pitopd/ptpulse/ptpulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ def _initialise_v2_hub_pulse():
if HDMI.set_as_audio_output() is False:
logger.warning("Failed to configure HDMI output")

HDMI_reboot = HDMI.set_hdmi_drive_in_boot_config(2)
HDMI.set_hdmi_drive_in_boot_config(2)
UART_reboot = _check_and_set_serial_config()
I2S_reboot = _check_and_set_I2S_config(False)

return HDMI_reboot or UART_reboot or I2S_reboot
return UART_reboot or I2S_reboot


def _initialise_v1_hub_pulse():
Expand Down
3 changes: 1 addition & 2 deletions pitopd/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def get(section: str, key: str, fallback=None):
except Exception:
if fallback is None:
raise
finally:
return val
return val


def set(section: str, key: str, value):
Expand Down
9 changes: 3 additions & 6 deletions pitopd/sys_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ def boot_config_correctly_configured(
expected_clock_val=None, expected_baud_val=None, expected_enabled_val=None
):

clock_val_okay = True
if expected_clock_val is not None:
if isinstance(expected_clock_val, int):
clock_string = _BootConfig.get_value(
Expand All @@ -592,9 +593,8 @@ def boot_config_correctly_configured(
logger.warning(
"Invalid init_uart_clock value to check for in /boot/config.txt - must be an integer"
)
else:
clock_val_okay = True

baud_val_okay = True
if expected_baud_val is not None:
if isinstance(expected_baud_val, int):
baud_string = _BootConfig.get_value(
Expand All @@ -605,9 +605,8 @@ def boot_config_correctly_configured(
logger.warning(
"Invalid init_uart_baud value to check for in /boot/config.txt - must be an integer"
)
else:
baud_val_okay = True

enabled_val_okay = True
if expected_enabled_val is not None:
if expected_enabled_val == 1 or expected_enabled_val == 0:
enabled_string = _BootConfig.get_value(
Expand All @@ -618,8 +617,6 @@ def boot_config_correctly_configured(
logger.warning(
"Invalid enable_uart value to check for in /boot/config.txt - must be 0 or 1"
)
else:
enabled_val_okay = True

return clock_val_okay and baud_val_okay and enabled_val_okay

Expand Down