Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fightwarn - pijuice #864

Merged
merged 7 commits into from
Nov 11, 2020
Merged

Conversation

jimklimov
Copy link
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

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

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