mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
staging:iio:fix using iio_priv or iio_dev after iio_unregister_device
This includes calling iio_free_device as that should only be called before the device has been registered. Also one case of iio_free_device being called on a registered device. This has been pulled out of the reworking attributes patch. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
acc131fa9f
commit
3e39440789
@ -538,8 +538,8 @@ static int adis16201_remove(struct spi_device *spi)
|
||||
|
||||
adis16201_remove_trigger(indio_dev);
|
||||
iio_ring_buffer_unregister(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
adis16201_unconfigure_ring(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -492,8 +492,8 @@ static int adis16203_remove(struct spi_device *spi)
|
||||
|
||||
adis16203_remove_trigger(indio_dev);
|
||||
iio_ring_buffer_unregister(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
adis16203_unconfigure_ring(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -567,8 +567,8 @@ static int adis16204_remove(struct spi_device *spi)
|
||||
|
||||
adis16204_remove_trigger(indio_dev);
|
||||
iio_ring_buffer_unregister(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
adis16204_unconfigure_ring(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -542,8 +542,8 @@ static int adis16209_remove(struct spi_device *spi)
|
||||
|
||||
adis16209_remove_trigger(indio_dev);
|
||||
iio_ring_buffer_unregister(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
adis16209_unconfigure_ring(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -596,8 +596,8 @@ static int adis16240_remove(struct spi_device *spi)
|
||||
|
||||
adis16240_remove_trigger(indio_dev);
|
||||
iio_ring_buffer_unregister(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
adis16240_unconfigure_ring(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -857,7 +857,6 @@ static int __devexit ad7291_remove(struct i2c_client *client)
|
||||
if (client->irq)
|
||||
free_irq(client->irq, indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_free_device(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -240,7 +240,6 @@ static int __devexit ad7314_remove(struct spi_device *spi_dev)
|
||||
|
||||
dev_set_drvdata(&spi_dev->dev, NULL);
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_free_device(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -443,7 +443,6 @@ static int __devexit ad7816_remove(struct spi_device *spi_dev)
|
||||
gpio_free(chip->convert_pin);
|
||||
gpio_free(chip->rdwr_pin);
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_free_device(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -864,7 +864,6 @@ static int __devexit adt7310_remove(struct spi_device *spi_dev)
|
||||
if (spi_dev->irq)
|
||||
free_irq(spi_dev->irq, indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_free_device(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -618,7 +618,6 @@ static int __devexit adt75_remove(struct i2c_client *client)
|
||||
if (client->irq)
|
||||
free_irq(client->irq, indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_free_device(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2225,7 +2225,6 @@ int __devexit adt7316_remove(struct device *dev)
|
||||
if (chip->bus.irq)
|
||||
free_irq(chip->bus.irq, indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_free_device(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -262,12 +262,12 @@ static int __devinit ad5624r_probe(struct spi_device *spi)
|
||||
indio_dev->info = &ad5624r_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
ret = iio_device_register(indio_dev);
|
||||
ret = ad5624r_spi_write(spi, AD5624R_CMD_INTERNAL_REFER_SETUP, 0,
|
||||
!!voltage_uv, 16);
|
||||
if (ret)
|
||||
goto error_free_dev;
|
||||
|
||||
ret = ad5624r_spi_write(spi, AD5624R_CMD_INTERNAL_REFER_SETUP, 0,
|
||||
!!voltage_uv, 16);
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret)
|
||||
goto error_free_dev;
|
||||
|
||||
|
@ -677,8 +677,8 @@ static int adis16260_remove(struct spi_device *spi)
|
||||
|
||||
adis16260_remove_trigger(indio_dev);
|
||||
iio_ring_buffer_unregister(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
adis16260_unconfigure_ring(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
err_ret:
|
||||
return ret;
|
||||
|
@ -547,7 +547,6 @@ static int ak8975_remove(struct i2c_client *client)
|
||||
int eoc_gpio = data->eoc_gpio;
|
||||
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_free_device(indio_dev);
|
||||
|
||||
if (eoc_gpio)
|
||||
gpio_free(eoc_gpio);
|
||||
|
@ -784,8 +784,8 @@ static int __devexit ad2s1210_remove(struct spi_device *spi)
|
||||
{
|
||||
struct iio_dev *indio_dev = spi_get_drvdata(spi);
|
||||
struct ad2s1210_state *st = iio_priv(indio_dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
ad2s1210_free_gpios(st);
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user