Only pin 0-7 support input, so the valid offset range should be 0 ~ 7.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
- if (offset > 8) {
+ if (offset >= 8) {
pr_err("only pin 0-7 support input\n");
return -1;/* we only have 8 GPIO can use as input */
}
int ret;
/* we only have 8 GPIO pins we can use as input */
- if (offset > 8)
+ if (offset >= 8)
return -EOPNOTSUPP;
ret = intel_scu_ipc_ioread8(GPIO0 + offset, &r);
if (ret < 0)