iio:accel: call device unregister function if common_proble fails
PATCH 1/4 iio:accel: call device unregister function if common_proble fails
If st_accel_common_probe function fails, the device must be unregistered. Used devm_iio_device_unregister function instead of iio_device_unregister also in the common remove function.
--- drivers/iio/accel/st_accel_core.c | 2 +- drivers/iio/accel/st_accel_i2c.c | 6 +++++- drivers/iio/accel/st_accel_spi.c | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-)
drivers/iio/accel/st_accel_core.c +1 -1
@@ -512,7 +512,7 @@ void st_accel_common_remove(struct iio_dev *indio_dev) {struct st_sensor_data *adata =iio_priv (indio_dev); -iio_device_unregister (indio_dev); +devm_iio_device_unregister (adata->dev, indio_dev);if (adata->get_irq_data_ready (indio_dev) >0 )st_sensors_deallocate_trigger (indio_dev);
drivers/iio/accel/st_accel_i2c.c +5 -1
@@ -36,9 +36,13 @@ static int st_accel_i2c_probe(struct i2c_client *client, err =st_accel_common_probe (indio_dev, client->dev.platform_data);if (err <0 ) -return err; + goto device_unregister;return 0 ; + +device_unregister: +devm_iio_device_unregister (&client->dev, indio_dev); +return err; }static int st_accel_i2c_remove (struct i2c_client *client)
drivers/iio/accel/st_accel_spi.c +5 -1
@@ -35,9 +35,13 @@ static int st_accel_spi_probe(struct spi_device *spi) err =st_accel_common_probe (indio_dev, spi->dev.platform_data);if (err <0 ) -return err; + goto device_unregister;return 0 ; + +device_unregister: +devm_iio_device_unregister (&spi->dev, indio_dev); +return err; }static int st_accel_spi_remove (struct spi_device *spi)
Signature · 1 line
1.8.5.4
PATCH 2/4 iio:gyro: call device unregister function if common_proble fails
If st_gyro_common_probe function fails, the device must be unregistered. Used devm_iio_device_unregister function instead of iio_device_unregister also in the common remove function.
--- drivers/iio/gyro/st_gyro_core.c | 2 +- drivers/iio/gyro/st_gyro_i2c.c | 6 +++++- drivers/iio/gyro/st_gyro_spi.c | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-)
drivers/iio/gyro/st_gyro_core.c +1 -1
@@ -360,7 +360,7 @@ void st_gyro_common_remove(struct iio_dev *indio_dev) {struct st_sensor_data *gdata =iio_priv (indio_dev); -iio_device_unregister (indio_dev); +devm_iio_device_unregister (gdata->dev, indio_dev);if (gdata->get_irq_data_ready (indio_dev) >0 )st_sensors_deallocate_trigger (indio_dev);
drivers/iio/gyro/st_gyro_i2c.c +5 -1
@@ -37,9 +37,13 @@ static int st_gyro_i2c_probe(struct i2c_client *client, err =st_gyro_common_probe (indio_dev, (struct st_sensors_platform_data *)&gyro_pdata);if (err <0 ) -return err; + goto device_unregister;return 0 ; + +device_unregister: +devm_iio_device_unregister (&client->dev, indio_dev); +return err; }static int st_gyro_i2c_remove (struct i2c_client *client)
drivers/iio/gyro/st_gyro_spi.c +5 -1
@@ -36,9 +36,13 @@ static int st_gyro_spi_probe(struct spi_device *spi) err =st_gyro_common_probe (indio_dev, (struct st_sensors_platform_data *)&gyro_pdata);if (err <0 ) -return err; + goto device_unregister;return 0 ; + +device_unregister: +devm_iio_device_unregister (&spi->dev, indio_dev); +return err; }static int st_gyro_spi_remove (struct spi_device *spi)
Signature · 1 line
1.8.5.4
PATCH 3/4 iio:magnetometer: call device unregister function if common_proble fails
In reply to Denis CIOCCAIf st_magn_common_probe function fails, the device must be unregistered. Used devm_iio_device_unregister function instead of iio_device_unregister also in the common remove function.
--- drivers/iio/magnetometer/st_magn_core.c | 2 +- drivers/iio/magnetometer/st_magn_i2c.c | 6 +++++- drivers/iio/magnetometer/st_magn_spi.c | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-)
drivers/iio/magnetometer/st_magn_core.c +1 -1
@@ -403,7 +403,7 @@ void st_magn_common_remove(struct iio_dev *indio_dev) {struct st_sensor_data *mdata =iio_priv (indio_dev); -iio_device_unregister (indio_dev); +devm_iio_device_unregister (mdata->dev, indio_dev);if (mdata->get_irq_data_ready (indio_dev) >0 )st_sensors_deallocate_trigger (indio_dev);
drivers/iio/magnetometer/st_magn_i2c.c +5 -1
@@ -36,9 +36,13 @@ static int st_magn_i2c_probe(struct i2c_client *client, err =st_magn_common_probe (indio_dev,NULL );if (err <0 ) -return err; + goto device_unregister;return 0 ; + +device_unregister: +devm_iio_device_unregister (&client->dev, indio_dev); +return err; }static int st_magn_i2c_remove (struct i2c_client *client)
drivers/iio/magnetometer/st_magn_spi.c +5 -1
@@ -35,9 +35,13 @@ static int st_magn_spi_probe(struct spi_device *spi) err =st_magn_common_probe (indio_dev,NULL );if (err <0 ) -return err; + goto device_unregister;return 0 ; + +device_unregister: +devm_iio_device_unregister (&spi->dev, indio_dev); +return err; }static int st_magn_spi_remove (struct spi_device *spi)
Signature · 1 line
1.8.5.4
PATCH 4/4 iio:pressure: call device unregister function if common_proble fails
In reply to Denis CIOCCAIf st_press_common_probe function fails, the device must be unregistered. Used devm_iio_device_unregister function instead of iio_device_unregister also in the common remove function.
--- drivers/iio/pressure/st_pressure_core.c | 2 +- drivers/iio/pressure/st_pressure_i2c.c | 6 +++++- drivers/iio/pressure/st_pressure_spi.c | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-)
drivers/iio/pressure/st_pressure_core.c +1 -1
@@ -419,7 +419,7 @@ void st_press_common_remove(struct iio_dev *indio_dev)st_press_power_disable (indio_dev); -iio_device_unregister (indio_dev); +devm_iio_device_unregister (pdata->dev, indio_dev);if (pdata->get_irq_data_ready (indio_dev) >0 )st_sensors_deallocate_trigger (indio_dev);
drivers/iio/pressure/st_pressure_i2c.c +5 -1
@@ -36,9 +36,13 @@ static int st_press_i2c_probe(struct i2c_client *client, err =st_press_common_probe (indio_dev, client->dev.platform_data);if (err <0 ) -return err; + goto device_unregister;return 0 ; + +device_unregister: +devm_iio_device_unregister (&client->dev, indio_dev); +return err; }static int st_press_i2c_remove (struct i2c_client *client)
drivers/iio/pressure/st_pressure_spi.c +5 -1
@@ -35,9 +35,13 @@ static int st_press_spi_probe(struct spi_device *spi) err =st_press_common_probe (indio_dev, spi->dev.platform_data);if (err <0 ) -return err; + goto device_unregister;return 0 ; + +device_unregister: +devm_iio_device_unregister (&spi->dev, indio_dev); +return err; }static int st_press_spi_remove (struct spi_device *spi)
Signature · 1 line
1.8.5.4