fix(m5stack_tab5): don't return NULL from int bsp_get_board_version() - #808
Open
vikramdattu wants to merge 1 commit into
Open
fix(m5stack_tab5): don't return NULL from int bsp_get_board_version()#808vikramdattu wants to merge 1 commit into
vikramdattu wants to merge 1 commit into
Conversation
vikramdattu
force-pushed
the
fix/tab5-board-version-int-conversion
branch
from
July 27, 2026 12:29
d3b18c3 to
7bd9b3f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7bd9b3f. Configure here.
BSP_ERROR_CHECK_RETURN_NULL expands to 'return NULL' when CONFIG_BSP_ERROR_CHECK is disabled, which fails to compile with -Wint-conversion inside the int-returning bsp_get_board_version(). Use BSP_ERROR_CHECK(x, 0) instead: abort-style behaviour is unchanged when CONFIG_BSP_ERROR_CHECK is enabled, and with it disabled the function returns 0 (version unknown) so the probe retries on the next call. Callers now fetch the version once and fail with ESP_ERR_NOT_SUPPORTED on an unknown version instead of silently skipping panel/touch driver creation.
vikramdattu
force-pushed
the
fix/tab5-board-version-int-conversion
branch
from
July 27, 2026 12:40
7bd9b3f to
8789c23
Compare
Collaborator
|
@vikramdattu Thank you for this fix. You are right. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

bsp_get_board_version()inbsp/m5stack_tab5/src/bsp_display.creturnsint, but usesBSP_ERROR_CHECK_RETURN_NULL. WhenCONFIG_BSP_ERROR_CHECKis disabled, that macro expands toreturn NULL;, so the file fails to compile with-Wint-conversion(an error with current toolchains):Any project that sets
CONFIG_BSP_ERROR_CHECK=n(return-error-code style instead of abort) cannot build the Tab5 BSP.Fix: use
BSP_ERROR_CHECK(x, 0). WithCONFIG_BSP_ERROR_CHECKenabled the behaviour is unchanged (ESP_ERROR_CHECK); with it disabled the function returns 0 ("version unknown") and, sinceboard_veronly caches values > 0, the probe retries on the next call.Hit in an app build (ESP-IDF v5.5.4, esp32p4, m5stack_tab5 1.2.0~1,
CONFIG_BSP_ERROR_CHECK=n). Verified the pre-fix code reproduces the exact error under-Werror=int-conversionand the fixed code compiles clean.Note
Low Risk
Localized BSP display/touch init fix and clearer error handling; behavior unchanged when error-check abort mode is enabled.
Overview
Fixes a build break when
CONFIG_BSP_ERROR_CHECK=n:bsp_get_board_version()now usesBSP_ERROR_CHECK(..., 0)instead ofBSP_ERROR_CHECK_RETURN_NULL, so it no longer emitsreturn NULLfrom anintfunction (-Wint-conversion).Display and touch setup cache the board version once per path and fail with
ESP_ERR_NOT_SUPPORTEDif probing did not yield version 1 or 2, instead of callingbsp_get_board_version()repeatedly and branching with separate== 2checks.Reviewed by Cursor Bugbot for commit 8789c23. Bugbot is set up for automated code reviews on this repo. Configure here.