CI: enable clang-tidy bugprone-assignment-in-if-condition (#26580)

* docs: auto-sync metadata [skip ci]

  Co-Authored-By: PX4 BuildBot <bot@px4.io>

CI: enable clang-tidy bugprone-assignment-in-if-condition

Signed-off-by: kuralme <kuralme@protonmail.com>

initialize and immediate assignments made one line

Signed-off-by: kuralme <kuralme@protonmail.com>

* two more initialization fix

Signed-off-by: kuralme <kuralme@protonmail.com>

---------

Signed-off-by: kuralme <kuralme@protonmail.com>
Co-authored-by: PX4BuildBot <bot@px4.io>
This commit is contained in:
Ege Kural
2026-02-27 04:04:45 -05:00
committed by GitHub
parent c424edd055
commit d317113dc8
11 changed files with 66 additions and 37 deletions
+9 -3
View File
@@ -182,7 +182,9 @@ InputMavlinkCmdMount::~InputMavlinkCmdMount()
int InputMavlinkCmdMount::initialize()
{
if ((_vehicle_command_sub = orb_subscribe(ORB_ID(vehicle_command))) < 0) {
_vehicle_command_sub = orb_subscribe(ORB_ID(vehicle_command));
if (_vehicle_command_sub < 0) {
return -errno;
}
@@ -438,11 +440,15 @@ int InputMavlinkGimbalV2::initialize()
return -errno;
}
if ((_vehicle_command_sub = orb_subscribe(ORB_ID(vehicle_command))) < 0) {
_vehicle_command_sub = orb_subscribe(ORB_ID(vehicle_command));
if (_vehicle_command_sub < 0) {
return -errno;
}
if ((_gimbal_manager_set_manual_control_sub = orb_subscribe(ORB_ID(gimbal_manager_set_manual_control))) < 0) {
_gimbal_manager_set_manual_control_sub = orb_subscribe(ORB_ID(gimbal_manager_set_manual_control));
if (_gimbal_manager_set_manual_control_sub < 0) {
return -errno;
}
@@ -1120,7 +1120,9 @@ void SimulatorMavlink::run()
if (_ip == InternetProtocol::UDP) {
if ((_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (_fd < 0) {
PX4_ERR("Creating UDP socket failed: %s", strerror(errno));
return;
}
@@ -1153,7 +1155,9 @@ void SimulatorMavlink::run()
PX4_INFO("Waiting for simulator to accept connection on TCP port %u", _port);
while (true) {
if ((_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
_fd = socket(AF_INET, SOCK_STREAM, 0);
if (_fd < 0) {
PX4_ERR("Creating TCP socket failed: %s", strerror(errno));
return;
}
@@ -851,17 +851,23 @@ bool UxrceddsClient::setBaudrate(int fd, unsigned baud)
}
/* set baud rate */
if ((termios_state = cfsetispeed(&uart_config, speed)) < 0) {
termios_state = cfsetispeed(&uart_config, speed);
if (termios_state < 0) {
PX4_ERR("ERR: %d (cfsetispeed)", termios_state);
return false;
}
if ((termios_state = cfsetospeed(&uart_config, speed)) < 0) {
termios_state = cfsetospeed(&uart_config, speed);
if (termios_state < 0) {
PX4_ERR("ERR: %d (cfsetospeed)", termios_state);
return false;
}
if ((termios_state = tcsetattr(fd, TCSANOW, &uart_config)) < 0) {
termios_state = tcsetattr(fd, TCSANOW, &uart_config);
if (termios_state < 0) {
PX4_ERR("ERR: %d (tcsetattr)", termios_state);
return false;
}