@@ -952,6 +952,7 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
if (pdata->get_pendown_state) {
ts->get_pendown_state = pdata->get_pendown_state;
+ ts->gpio_pendown = -EINVAL;
return 0;
}
@@ -1353,7 +1354,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
err_put_regulator:
regulator_put(ts->reg);
err_free_gpio:
- if (ts->gpio_pendown != -1)
+ if (gpio_is_valid(ts->gpio_pendown))
gpio_free(ts->gpio_pendown);
err_cleanup_filter:
if (ts->filter_cleanup)