mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Fixed current and potential bugs caught by Coverity
Change-Id: I9f9d09dc797ffea062eeb49c881be1d5acb63d7b
This commit is contained in:
committed by
Peter Johnson
parent
b0fec4089b
commit
055ee09825
@@ -273,7 +273,9 @@ uint32_t getAnalogOversampleBits(void* analog_port_pointer, int32_t *status) {
|
||||
int16_t getAnalogValue(void* analog_port_pointer, int32_t *status) {
|
||||
AnalogPort* port = (AnalogPort*) analog_port_pointer;
|
||||
int16_t value;
|
||||
checkAnalogInputChannel(port->port.pin);
|
||||
if (!checkAnalogInputChannel(port->port.pin)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
tAI::tReadSelect readSelect;
|
||||
readSelect.Channel = port->port.pin;
|
||||
@@ -304,7 +306,9 @@ int16_t getAnalogValue(void* analog_port_pointer, int32_t *status) {
|
||||
int32_t getAnalogAverageValue(void* analog_port_pointer, int32_t *status) {
|
||||
AnalogPort* port = (AnalogPort*) analog_port_pointer;
|
||||
int32_t value;
|
||||
checkAnalogInputChannel(port->port.pin);
|
||||
if (!checkAnalogInputChannel(port->port.pin)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
tAI::tReadSelect readSelect;
|
||||
readSelect.Channel = port->port.pin;
|
||||
|
||||
Reference in New Issue
Block a user