[riot-notifications] [RIOT-OS/RIOT] sam0_common: check ADC_NUMOF on adc_init() (#10936)
notifications at github.com
Mon Feb 4 09:32:58 CET 2019
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
### Contribution description
While working on a [private project](https://github.com/miri64/RIOT_playground/tree/master/wand), I noticed that `adc_init` for `sam0_common` doesn't check the correctness of the `line` parameter. The doc states it [should return -1](http://doc.riot-os.org/group__drivers__periph__adc.html#ga259a7b0176a8a6f5a5e61aabce3574f0) on error, so I added the missing check and return.
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
### Testing procedure
Try initializing ADC on a `sam0` based board (e.g. `samr21-xpro) for a line that is not defined (e.g. `ADC_LINE(9)`). Without this PR the board will crash. With it, the function will just return -1.
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
### Issues/PRs references
Examples: Fixes #1234. See also #5678. Depends on PR #9876.
Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* sam0_common: check ADC_NUMOF on adc_init()
-- File Changes --
M cpu/sam0_common/periph/adc.c (4)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications