Skip to content

Commit bb62658

Browse files
committed
Avoid the Error: 'RegValue' may be used uninitialized
porthub.cpp:56:12: error: 'RegValue' may be used uninitialized in this function [-Werror=maybe-uninitialized]
1 parent 59d4ade commit bb62658

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/Unit/PbHUB/porthub.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ uint16_t PortHub::hub_a_read_value(uint8_t reg) {
1616
Wire.write(reg | 0x06);
1717
Wire.endTransmission();
1818

19-
uint8_t RegValue_L, RegValue_H;
19+
uint8_t RegValue_L = 0;
20+
uint8_t RegValue_H = 0;
2021

2122
Wire.requestFrom(_iic_addr, 2);
2223
while (Wire.available()) {
@@ -32,7 +33,7 @@ uint8_t PortHub::hub_d_read_value_A(uint8_t reg) {
3233
Wire.write(reg | 0x04);
3334
Wire.endTransmission();
3435

35-
uint8_t RegValue;
36+
uint8_t RegValue = 0;
3637

3738
Wire.requestFrom(_iic_addr, 1);
3839
while (Wire.available()) {

0 commit comments

Comments
 (0)