mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 10:50:35 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user