Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b909459f authored by Sachin Kamat's avatar Sachin Kamat Committed by Jonathan Cameron
Browse files

staging: iio: ade7854: Use devm_iio_device_alloc



devm_iio_device_alloc makes code simpler.

Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Cc: Barry Song <21cnbao@gmail.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent b67637a3
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ static int ade7854_i2c_probe(struct i2c_client *client,
	struct ade7854_state *st;
	struct iio_dev *indio_dev;

	indio_dev = iio_device_alloc(sizeof(*st));
	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st));
	if (indio_dev == NULL)
		return -ENOMEM;
	st = iio_priv(indio_dev);
@@ -225,8 +225,6 @@ static int ade7854_i2c_probe(struct i2c_client *client,
	st->irq = client->irq;

	ret = ade7854_probe(indio_dev, &client->dev);
	if (ret)
		iio_device_free(indio_dev);

	return ret;
}
+1 −3
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ static int ade7854_spi_probe(struct spi_device *spi)
	struct ade7854_state *st;
	struct iio_dev *indio_dev;

	indio_dev = iio_device_alloc(sizeof(*st));
	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
	if (indio_dev == NULL)
		return -ENOMEM;
	st = iio_priv(indio_dev);
@@ -296,8 +296,6 @@ static int ade7854_spi_probe(struct spi_device *spi)


	ret = ade7854_probe(indio_dev, &spi->dev);
	if (ret)
		iio_device_free(indio_dev);

	return 0;
}
+1 −5
Original line number Diff line number Diff line
@@ -550,7 +550,7 @@ int ade7854_probe(struct iio_dev *indio_dev, struct device *dev)

	ret = iio_device_register(indio_dev);
	if (ret)
		goto error_free_dev;
		return ret;

	/* Get the device into a sane initial state */
	ret = ade7854_initial_setup(indio_dev);
@@ -561,9 +561,6 @@ int ade7854_probe(struct iio_dev *indio_dev, struct device *dev)

error_unreg_dev:
	iio_device_unregister(indio_dev);
error_free_dev:
	iio_device_free(indio_dev);

	return ret;
}
EXPORT_SYMBOL(ade7854_probe);
@@ -571,7 +568,6 @@ EXPORT_SYMBOL(ade7854_probe);
int ade7854_remove(struct iio_dev *indio_dev)
{
	iio_device_unregister(indio_dev);
	iio_device_free(indio_dev);

	return 0;
}