From: Rob Herring Date: Fri, 16 Oct 2009 19:41:52 +0000 (-0500) Subject: tsc2007: fail registration on i2c error X-Git-Tag: v3.0.35-fsl~2501 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7f9ee3e6babf3dcfb199dc76d17d9cf8058c20ef;p=karo-tx-linux.git tsc2007: fail registration on i2c error Return an error on probe if i2c errors occur indicating the device is not present. Signed-off-by: Rob Herring --- diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index fadc11545b1e..da7432726c99 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -300,6 +300,13 @@ static int __devinit tsc2007_probe(struct i2c_client *client, ts->get_pendown_state = pdata->get_pendown_state; ts->clear_penirq = pdata->clear_penirq; + pdata->init_platform_hw(); + + if (tsc2007_xfer(ts, PWRDOWN) < 0) { + err = -ENODEV; + goto err_no_dev; + } + snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&client->dev)); @@ -344,6 +351,8 @@ static int __devinit tsc2007_probe(struct i2c_client *client, pdata->exit_platform_hw(); err_free_mem: input_free_device(input_dev); + err_no_dev: + pdata->exit_platform_hw(); kfree(ts); return err; }