soc/intel/apollolake: add assert for pad constraints
Ensure the pads passed into the gpio functions are within range. Change-Id: Ic523cbfaf60a46709080347af3a36d6330f9a07c Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13694 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <soc/gpio.h>
|
||||
#include <soc/iosf.h>
|
||||
|
||||
@ -37,6 +38,8 @@ static const struct pad_community *gpio_get_community(uint16_t pad)
|
||||
{
|
||||
const struct pad_community *map = gpio_communities;
|
||||
|
||||
assert(pad < TOTAL_PADS);
|
||||
|
||||
while (map->first_pad > pad)
|
||||
map++;
|
||||
|
||||
|
Reference in New Issue
Block a user