gcc thinks the static "led_index" could get out of range - not sure
how that should happen, but test for >= instead of == on the array size.
This commit is contained in:
parent
258ba86eac
commit
da433f6296
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ralink_gpio.c,v 1.7 2019/06/03 06:04:20 msaitoh Exp $ */
|
||||
/* $NetBSD: ralink_gpio.c,v 1.8 2020/03/10 11:07:39 martin Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2011 CradlePoint Technology, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -29,7 +29,7 @@
|
|||
/* ra_gpio.c -- Ralink 3052 gpio driver */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ralink_gpio.c,v 1.7 2019/06/03 06:04:20 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ralink_gpio.c,v 1.8 2020/03/10 11:07:39 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
|
@ -1580,7 +1580,7 @@ ra_gpio_toggle_LED(void *arg)
|
|||
(1 << (led_array1[led_index++] - SS_OFFSET)));
|
||||
#endif
|
||||
|
||||
if (led_index == (sizeof(led_array1))) {
|
||||
if (led_index >= (sizeof(led_array1))) {
|
||||
led_index = 0;
|
||||
for (int i = 0; i < sizeof(led_array1); i++) {
|
||||
ra_gpio_pin_write(sc, led_array1[i], 1);
|
||||
|
|
Loading…
Reference in New Issue