Skip to content

Fightwarn - pijuice#864

Merged
jimklimov merged 7 commits intonetworkupstools:masterfrom
jimklimov:fightwarn-pijuice
Nov 11, 2020
Merged

Fightwarn - pijuice#864
jimklimov merged 7 commits intonetworkupstools:masterfrom
jimklimov:fightwarn-pijuice

Conversation

@jimklimov
Copy link
Copy Markdown
Member

This PR follows up from recently merged #730 that added the PiJuice HAT driver, and #844 effort that hunts for warnings. It fixes several complaints about exceeded data type ranges and/or meaningless comparisons (is an uint8_t < 0? is it > 255? neither can be, ever...)

Another issue was about __FUNCTION__ being apparently a hack introduced by GCC, and only later a __func__ was added into standards and superseded it.

CC @aander07 for review (and possible similar bug-hunts in your other code).

@jimklimov jimklimov requested review from clepple and zykh November 9, 2020 15:03
@lgtm-com
Copy link
Copy Markdown

lgtm-com Bot commented Nov 9, 2020

This pull request fixes 1 alert when merging 7ece017bd872475e92f1dffe0d0a03625aaa1af5 into 26c8994 - view on LGTM.com

fixed alerts:

  • 1 for Comparison result is always the same

Compiler warnings resolved this puzzle:

[2020-11-09 15:10:38] [build-err] pijuice.c:737:2: note: in expansion of macro ‘I2C_WRITE_BYTE’
[2020-11-09 15:10:38] [build-err]   737 |  I2C_WRITE_BYTE( upsfd, cmd, shutdown_delay, __func__ )
[2020-11-09 15:10:38] [build-err]       |  ^~~~~~~~~~~~~~
[2020-11-09 15:10:38] [build-err] pijuice.c:710:10: warning: variable ‘data’ set but not used [-Wunused-but-set-variable]
[2020-11-09 15:10:38] [build-err]   710 |  uint8_t data;
[2020-11-09 15:10:38] [build-err]       |          ^~~~

So we did not need to set it at all, can go to simple
anonymous negative-return check.
@lgtm-com
Copy link
Copy Markdown

lgtm-com Bot commented Nov 9, 2020

This pull request fixes 1 alert when merging 08af693 into 26c8994 - view on LGTM.com

fixed alerts:

  • 1 for Comparison result is always the same

@jimklimov jimklimov merged commit 16f2ee7 into networkupstools:master Nov 11, 2020
@jimklimov jimklimov deleted the fightwarn-pijuice branch November 15, 2020 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant