* use the other ADC lines a bit differently too
*/
if (ts->model == 7846) {
- device_create_file(&spi->dev, &dev_attr_temp0);
- device_create_file(&spi->dev, &dev_attr_temp1);
+ err = device_create_file(&spi->dev, &dev_attr_temp0);
+ if (err)
+ goto err_remove_attr7;
+ err = device_create_file(&spi->dev, &dev_attr_temp1);
+ if (err)
+ goto err_remove_attr6;
}
/* in1 == vBAT (7846), or a non-scaled ADC input */
- if (ts->model != 7845)
- device_create_file(&spi->dev, &dev_attr_in1_input);
+ if (ts->model != 7845) {
+ err = device_create_file(&spi->dev, &dev_attr_in1_input);
+ if (err)
+ goto err_remove_attr5;
+ }
/* in0 == a non-scaled ADC input */
- device_create_file(&spi->dev, &dev_attr_in0_input);
+ err = device_create_file(&spi->dev, &dev_attr_in0_input);
+ if (err)
+ goto err_remove_attr4;
/* non-hwmon device attributes */
- device_create_file(&spi->dev, &dev_attr_pen_down);
- device_create_file(&spi->dev, &dev_attr_disable);
+ err = device_create_file(&spi->dev, &dev_attr_pen_down);
+ if (err)
+ goto err_remove_attr3;
+ err = device_create_file(&spi->dev, &dev_attr_disable);
+ if (err)
+ goto err_remove_attr2;
err = input_register_device(input_dev);
if (err)
- goto err_remove_attr;
+ goto err_remove_attr1;
return 0;
- err_remove_attr:
+ err_remove_attr1:
device_remove_file(&spi->dev, &dev_attr_disable);
+ err_remove_attr2:
device_remove_file(&spi->dev, &dev_attr_pen_down);
+ err_remove_attr3:
+ device_remove_file(&spi->dev, &dev_attr_in0_input);
+ err_remove_attr4:
+ if (ts->model != 7845)
+ device_remove_file(&spi->dev, &dev_attr_in1_input);
+ err_remove_attr5:
if (ts->model == 7846) {
device_remove_file(&spi->dev, &dev_attr_temp1);
+ err_remove_attr6:
device_remove_file(&spi->dev, &dev_attr_temp0);
}
- if (ts->model != 7845)
- device_remove_file(&spi->dev, &dev_attr_in1_input);
- device_remove_file(&spi->dev, &dev_attr_in0_input);
-
+ err_remove_attr7:
free_irq(spi->irq, ts);
err_cleanup_filter:
if (ts->filter_cleanup)