--- zzzz-none-000/linux-3.10.107/drivers/platform/x86/intel_pmic_gpio.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/platform/x86/intel_pmic_gpio.c 2021-02-04 17:41:59.000000000 +0000 @@ -91,7 +91,7 @@ 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 */ } @@ -130,7 +130,7 @@ 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) @@ -288,7 +288,7 @@ retval = request_irq(pg->irq, pmic_irq_handler, 0, "pmic", pg); if (retval) { pr_warn("Interrupt request failed\n"); - goto err; + goto fail_request_irq; } for (i = 0; i < 8; i++) { @@ -299,6 +299,9 @@ irq_set_chip_data(i + pg->irq_base, pg); } return 0; + +fail_request_irq: + gpiochip_remove(&pg->chip); err: iounmap(pg->gpiointr); err2: @@ -311,7 +314,6 @@ static struct platform_driver platform_pmic_gpio_driver = { .driver = { .name = DRIVER_NAME, - .owner = THIS_MODULE, }, .probe = platform_pmic_gpio_probe, };