From 5099df00ec5c841ffbb946288bd6f4a6d76b80f1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 25 Oct 2025 16:36:10 -0700 Subject: [PATCH 1/2] missing zero init --- esphome/components/esp32/gpio.h | 6 +++--- esphome/components/esp8266/gpio.h | 6 +++--- esphome/components/host/gpio.h | 6 +++--- esphome/components/libretiny/gpio_arduino.h | 6 +++--- esphome/components/rp2040/gpio.h | 6 +++--- esphome/components/zephyr/gpio.h | 10 +++++----- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/esphome/components/esp32/gpio.h b/esphome/components/esp32/gpio.h index 565e276ea8..ecd464edb6 100644 --- a/esphome/components/esp32/gpio.h +++ b/esphome/components/esp32/gpio.h @@ -40,13 +40,13 @@ class ESP32InternalGPIOPin : public InternalGPIOPin { // - 3 bytes for members below // - 1 byte padding for alignment // - 4 bytes for vtable pointer - uint8_t pin_; // GPIO pin number (0-255, actual max ~54 on ESP32) - gpio::Flags flags_; // GPIO flags (1 byte) + uint8_t pin_{}; // GPIO pin number (0-255, actual max ~54 on ESP32) + gpio::Flags flags_{}; // GPIO flags (1 byte) struct PinFlags { uint8_t inverted : 1; // Invert pin logic (1 bit) uint8_t drive_strength : 2; // Drive strength 0-3 (2 bits) uint8_t reserved : 5; // Reserved for future use (5 bits) - } pin_flags_; // Total: 1 byte + } pin_flags_{}; // Total: 1 byte // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) static bool isr_service_installed; }; diff --git a/esphome/components/esp8266/gpio.h b/esphome/components/esp8266/gpio.h index dd6407885e..230fed9569 100644 --- a/esphome/components/esp8266/gpio.h +++ b/esphome/components/esp8266/gpio.h @@ -28,9 +28,9 @@ class ESP8266GPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_; - bool inverted_; - gpio::Flags flags_; + uint8_t pin_{}; + bool inverted_{}; + gpio::Flags flags_{}; }; } // namespace esp8266 diff --git a/esphome/components/host/gpio.h b/esphome/components/host/gpio.h index a60d535912..3a6670926d 100644 --- a/esphome/components/host/gpio.h +++ b/esphome/components/host/gpio.h @@ -27,9 +27,9 @@ class HostGPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_; - bool inverted_; - gpio::Flags flags_; + uint8_t pin_{}; + bool inverted_{}; + gpio::Flags flags_{}; }; } // namespace host diff --git a/esphome/components/libretiny/gpio_arduino.h b/esphome/components/libretiny/gpio_arduino.h index 9adc425a41..9838718b00 100644 --- a/esphome/components/libretiny/gpio_arduino.h +++ b/esphome/components/libretiny/gpio_arduino.h @@ -26,9 +26,9 @@ class ArduinoInternalGPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_; - bool inverted_; - gpio::Flags flags_; + uint8_t pin_{}; + bool inverted_{}; + gpio::Flags flags_{}; }; } // namespace libretiny diff --git a/esphome/components/rp2040/gpio.h b/esphome/components/rp2040/gpio.h index 9bc66d9e4b..0f067d03ce 100644 --- a/esphome/components/rp2040/gpio.h +++ b/esphome/components/rp2040/gpio.h @@ -28,9 +28,9 @@ class RP2040GPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_; - bool inverted_; - gpio::Flags flags_; + uint8_t pin_{}; + bool inverted_{}; + gpio::Flags flags_{}; }; } // namespace rp2040 diff --git a/esphome/components/zephyr/gpio.h b/esphome/components/zephyr/gpio.h index f512ae4648..9d0aa6b080 100644 --- a/esphome/components/zephyr/gpio.h +++ b/esphome/components/zephyr/gpio.h @@ -25,11 +25,11 @@ class ZephyrGPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_; - bool inverted_; - gpio::Flags flags_; - const device *gpio_ = nullptr; - bool value_ = false; + uint8_t pin_{}; + bool inverted_{}; + gpio::Flags flags_{}; + const device *gpio_{nullptr}; + bool value_{false}; }; } // namespace zephyr From 22b574992f243548660696b520d5e2d138932d04 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 25 Oct 2025 16:47:48 -0700 Subject: [PATCH 2/2] no zero init pin --- esphome/components/esp32/gpio.h | 2 +- esphome/components/esp8266/gpio.h | 2 +- esphome/components/host/gpio.h | 2 +- esphome/components/libretiny/gpio_arduino.h | 2 +- esphome/components/rp2040/gpio.h | 2 +- esphome/components/zephyr/gpio.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/esphome/components/esp32/gpio.h b/esphome/components/esp32/gpio.h index ecd464edb6..d30f4bdcba 100644 --- a/esphome/components/esp32/gpio.h +++ b/esphome/components/esp32/gpio.h @@ -40,7 +40,7 @@ class ESP32InternalGPIOPin : public InternalGPIOPin { // - 3 bytes for members below // - 1 byte padding for alignment // - 4 bytes for vtable pointer - uint8_t pin_{}; // GPIO pin number (0-255, actual max ~54 on ESP32) + uint8_t pin_; // GPIO pin number (0-255, actual max ~54 on ESP32) gpio::Flags flags_{}; // GPIO flags (1 byte) struct PinFlags { uint8_t inverted : 1; // Invert pin logic (1 bit) diff --git a/esphome/components/esp8266/gpio.h b/esphome/components/esp8266/gpio.h index 230fed9569..a1b6d79b3b 100644 --- a/esphome/components/esp8266/gpio.h +++ b/esphome/components/esp8266/gpio.h @@ -28,7 +28,7 @@ class ESP8266GPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_{}; + uint8_t pin_; bool inverted_{}; gpio::Flags flags_{}; }; diff --git a/esphome/components/host/gpio.h b/esphome/components/host/gpio.h index 3a6670926d..ae677291b9 100644 --- a/esphome/components/host/gpio.h +++ b/esphome/components/host/gpio.h @@ -27,7 +27,7 @@ class HostGPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_{}; + uint8_t pin_; bool inverted_{}; gpio::Flags flags_{}; }; diff --git a/esphome/components/libretiny/gpio_arduino.h b/esphome/components/libretiny/gpio_arduino.h index 9838718b00..3674748c18 100644 --- a/esphome/components/libretiny/gpio_arduino.h +++ b/esphome/components/libretiny/gpio_arduino.h @@ -26,7 +26,7 @@ class ArduinoInternalGPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_{}; + uint8_t pin_; bool inverted_{}; gpio::Flags flags_{}; }; diff --git a/esphome/components/rp2040/gpio.h b/esphome/components/rp2040/gpio.h index 0f067d03ce..47a6fe17f2 100644 --- a/esphome/components/rp2040/gpio.h +++ b/esphome/components/rp2040/gpio.h @@ -28,7 +28,7 @@ class RP2040GPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_{}; + uint8_t pin_; bool inverted_{}; gpio::Flags flags_{}; }; diff --git a/esphome/components/zephyr/gpio.h b/esphome/components/zephyr/gpio.h index 9d0aa6b080..6e8f81857a 100644 --- a/esphome/components/zephyr/gpio.h +++ b/esphome/components/zephyr/gpio.h @@ -25,7 +25,7 @@ class ZephyrGPIOPin : public InternalGPIOPin { protected: void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override; - uint8_t pin_{}; + uint8_t pin_; bool inverted_{}; gpio::Flags flags_{}; const device *gpio_{nullptr};