[FL-2811] Fix PVS-Studio warnings (#2142)

Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: gornekich <n.gorbadey@gmail.com>
This commit is contained in:
Georgii Surkov
2022-12-26 15:13:30 +03:00
committed by GitHub
parent ad3bff0b67
commit 8582670a34
201 changed files with 719 additions and 743 deletions

View File

@@ -62,8 +62,6 @@ const char* ibutton_key_get_string_by_type(iButtonKeyType key_type) {
break;
default:
furi_crash("Invalid iButton type");
return "";
break;
}
}

View File

@@ -130,7 +130,6 @@ bool ibutton_worker_read_comparator(iButtonWorker* worker) {
ibutton_key_set_data(worker->key_p, worker->key_data, ibutton_key_get_max_size());
result = true;
break;
break;
default:
break;
}

View File

@@ -72,7 +72,7 @@ static bool writer_write_TM2004(iButtonWriter* writer, iButtonKey* key) {
writer_write_one_bit(writer, 1, 50000);
// read written key byte
answer = onewire_host_read(writer->host);
answer = onewire_host_read(writer->host); //-V519
// check that written and read are same
if(ibutton_key_get_data_p(key)[i] != answer) {

View File

@@ -270,10 +270,10 @@ static LevelDuration protocol_cyfral_encoder_yield(ProtocolCyfral* proto) {
// start word (0b0001)
switch(proto->encoder.index) {
case 0:
result = level_duration_make(false, CYFRAL_0_LOW);
result = level_duration_make(false, CYFRAL_0_LOW); //-V1037
break;
case 1:
result = level_duration_make(true, CYFRAL_0_HI);
result = level_duration_make(true, CYFRAL_0_HI); //-V1037
break;
case 2:
result = level_duration_make(false, CYFRAL_0_LOW);
@@ -341,4 +341,4 @@ const ProtocolBase protocol_cyfral = {
.start = (ProtocolEncoderStart)protocol_cyfral_encoder_start,
.yield = (ProtocolEncoderYield)protocol_cyfral_encoder_yield,
},
};
};

View File

@@ -248,14 +248,14 @@ static LevelDuration protocol_metakom_encoder_yield(ProtocolMetakom* proto) {
if(proto->encoder.index == 0) {
// sync bit
result = level_duration_make(false, METAKOM_PERIOD);
} else if(proto->encoder.index >= 1 && proto->encoder.index <= 6) {
} else if(proto->encoder.index <= 6) {
// start word (0b010)
switch(proto->encoder.index) {
case 1:
result = level_duration_make(true, METAKOM_0_LOW);
result = level_duration_make(true, METAKOM_0_LOW); //-V1037
break;
case 2:
result = level_duration_make(false, METAKOM_0_HI);
result = level_duration_make(false, METAKOM_0_HI); //-V1037
break;
case 3:
result = level_duration_make(true, METAKOM_1_LOW);
@@ -317,4 +317,4 @@ const ProtocolBase protocol_metakom = {
.start = (ProtocolEncoderStart)protocol_metakom_encoder_start,
.yield = (ProtocolEncoderYield)protocol_metakom_encoder_yield,
},
};
};

View File

@@ -41,7 +41,7 @@ uint32_t onewire_slave_wait_while_gpio_is(OneWireSlave* bus, uint32_t time, cons
uint32_t time_ticks = time * furi_hal_cortex_instructions_per_microsecond();
uint32_t time_captured;
do {
do { //-V1044
time_captured = DWT->CYCCNT;
if(furi_hal_ibutton_pin_get_level() != pin_value) {
uint32_t remaining_time = time_ticks - (time_captured - start);
@@ -155,8 +155,10 @@ bool onewire_slave_receive_and_process_cmd(OneWireSlave* bus) {
uint8_t cmd;
onewire_slave_receive(bus, &cmd, 1);
if(bus->error == RESET_IN_PROGRESS) return true;
if(bus->error != NO_ERROR) return false;
if(bus->error == RESET_IN_PROGRESS)
return true;
else if(bus->error != NO_ERROR)
return false;
switch(cmd) {
case 0xF0:
@@ -172,10 +174,8 @@ bool onewire_slave_receive_and_process_cmd(OneWireSlave* bus) {
default: // Unknown command
bus->error = INCORRECT_ONEWIRE_CMD;
return false;
}
if(bus->error == RESET_IN_PROGRESS) return true;
return (bus->error == NO_ERROR);
}
bool onewire_slave_bus_start(OneWireSlave* bus) {