Skip to content

Commit 67c590d

Browse files
Remove virtual from resolve_actual_clock_speed to fix CodeQL alerts (#90)
Calling a virtual method during construction bypasses virtual dispatch. Since resolve_actual_clock_speed is never called polymorphically through the base class, remove the virtual declaration from PlatformDma and the override specifiers from the three platform implementations. Fixes clang-analyzer-optin.cplusplus.VirtualCall alerts on gdma_dma.cpp, i2s_dma.cpp, and parlio_dma.cpp. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d19154f commit 67c590d

File tree

4 files changed

+3
-14
lines changed

4 files changed

+3
-14
lines changed

components/hub75/src/platforms/gdma/gdma_dma.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class GdmaDma : public PlatformDma {
6969
/**
7070
* @brief Resolve clock speed to achievable frequency (160 MHz / N)
7171
*/
72-
HUB75_CONST uint32_t resolve_actual_clock_speed(Hub75ClockSpeed clock_speed) const override;
72+
HUB75_CONST uint32_t resolve_actual_clock_speed(Hub75ClockSpeed clock_speed) const;
7373

7474
// ============================================================================
7575
// Pixel API (Direct DMA Buffer Writes)

components/hub75/src/platforms/i2s/i2s_dma.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class I2sDma : public PlatformDma {
7171
* ESP32: max 10 MHz (80 MHz / 2 / 4)
7272
* ESP32-S2: max 20 MHz (160 MHz / 2 / 4)
7373
*/
74-
HUB75_CONST uint32_t resolve_actual_clock_speed(Hub75ClockSpeed clock_speed) const override;
74+
HUB75_CONST uint32_t resolve_actual_clock_speed(Hub75ClockSpeed clock_speed) const;
7575

7676
// ============================================================================
7777
// Pixel API (Direct DMA Buffer Writes)

components/hub75/src/platforms/parlio/parlio_dma.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ParlioDma : public PlatformDma {
4646
/**
4747
* @brief Resolve clock speed to achievable frequency (160 MHz / N)
4848
*/
49-
HUB75_CONST uint32_t resolve_actual_clock_speed(Hub75ClockSpeed clock_speed) const override;
49+
HUB75_CONST uint32_t resolve_actual_clock_speed(Hub75ClockSpeed clock_speed) const;
5050

5151
void draw_pixels(uint16_t x, uint16_t y, uint16_t w, uint16_t h, const uint8_t *buffer, Hub75PixelFormat format,
5252
Hub75ColorOrder color_order, bool big_endian) override;

components/hub75/src/platforms/platform_dma.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,6 @@ class PlatformDma {
4242
const Hub75Config &config_;
4343
uint16_t lut_[256]; // LUT storage (512 bytes, initialized at runtime)
4444

45-
/**
46-
* @brief Resolve requested clock speed to achievable frequency
47-
*
48-
* Called from constructor to determine actual clock frequency for BCM timing.
49-
* Each platform implements based on its hardware clock divider constraints.
50-
*
51-
* @param clock_speed Requested clock speed
52-
* @return Achievable frequency in Hz
53-
*/
54-
virtual HUB75_CONST uint32_t resolve_actual_clock_speed(Hub75ClockSpeed clock_speed) const = 0;
55-
5645
// ============================================================================
5746
// Brightness Remapping (Quadratic Curve)
5847
// ============================================================================

0 commit comments

Comments
 (0)