if hardware number different to array index,it needs to clear to points memory space if the array_info have been assigned a value. Signed-off-by: Yan Wang <rk.code@xxxxxxxxxxx> --- drivers/gpio/gpiolib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 04fb05df805b..cdaffcdd45b2 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4340,8 +4340,11 @@ struct gpio_descs *__must_check gpiod_get_array(struct device *dev, } /* If there is no cache for fast bitmap processing path, continue */ - if (!array_info) + if (!array_info) { + /*clear descs->info*/ + memset(array_info, 0, sizeof(struct gpio_array)); continue; + } /* Unmark array members which don't belong to the 'fast' chip */ if (array_info->chip != gc) { -- 2.17.1