<h3>Contribution description</h3>
<p>While working on a <a href="https://github.com/miri64/RIOT_playground/tree/master/wand">private project</a>, I noticed that <code>adc_init</code> for <code>sam0_common</code> doesn't check the correctness of the <code>line</code> parameter. The doc states it <a href="http://doc.riot-os.org/group__drivers__periph__adc.html#ga259a7b0176a8a6f5a5e61aabce3574f0" rel="nofollow">should return -1</a> on error, so I added the missing check and return.</p>

<h3>Testing procedure</h3>
<p>Try initializing ADC on a <code>sam0</code> based board (e.g. <code>samr21-xpro) for a line that is not defined (e.g. </code>ADC_LINE(9)`). Without this PR the board will crash. With it, the function will just return -1.</p>

<h3>Issues/PRs references</h3>
<p>None</p>


<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/10936'>https://github.com/RIOT-OS/RIOT/pull/10936</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>sam0_common: check ADC_NUMOF on adc_init()</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/10936/files#diff-0">cpu/sam0_common/periph/adc.c</a>
    (4)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/10936.patch'>https://github.com/RIOT-OS/RIOT/pull/10936.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/10936.diff'>https://github.com/RIOT-OS/RIOT/pull/10936.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/10936">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AEn7YEeTeT9CVAR40gcD2Rx-xFl9usKXks5vJ_A6gaJpZM4agviU">mute the thread</a>.<img src="https://github.com/notifications/beacon/AEn7YCLSdu5N8A2tVGIurdWkgdj6mWP8ks5vJ_A6gaJpZM4agviU.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/RIOT-OS/RIOT","title":"RIOT-OS/RIOT","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/RIOT-OS/RIOT"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"sam0_common: check ADC_NUMOF on adc_init() (#10936)"}],"action":{"name":"View Pull Request","url":"https://github.com/RIOT-OS/RIOT/pull/10936"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/10936",
"url": "https://github.com/RIOT-OS/RIOT/pull/10936",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>