Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • F firmware
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare revisions
  • Issues 74
    • Issues 74
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 29
    • Merge requests 29
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • card10card10
  • firmware
  • Merge requests
  • !357

fix(bhi, leds): fixed faulty error handling due to always-false unsigned comparisons

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged fuchsi* requested to merge fuchsi/firmware:faulty_unsigned_comparisons into master Nov 19, 2019
  • Overview 7
  • Commits 1
  • Pipelines 1
  • Changes 3

-Wtype-limits revealed three errors in the firmware:

../pycardium/modules/sys_leds.c: In function 'mp_leds_get_rocket':
../pycardium/modules/sys_leds.c:207:10: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  207 |  if (ret == -EINVAL) {
      |          ^~


../pycardium/mphalport.c: In function 'mp_hal_set_interrupt_char':
../pycardium/mphalport.c:115:8: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  115 |  if (c != -1) {
      |        ^~

../epicardium/modules/bhi.c: In function 'epic_bhi160_enable_sensor':
../epicardium/modules/bhi.c:134:12: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  134 |  if (vs_id < 0) {
      |            ^
../epicardium/modules/bhi.c: In function 'epic_bhi160_disable_sensor':
../epicardium/modules/bhi.c:191:12: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  191 |  if (vs_id < 0) {
      |            ^

note, that on the target platform char and enums are unsigned. The compiler has probably removed all of these ifs so far because the conditions were determined to always be false.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: faulty_unsigned_comparisons