Re: [PATCH 4/4] staging: iio: accel: Move adis16201 driver out of staging

From: Dan Carpenter
Date: Mon Feb 12 2018 - 08:24:13 EST


I think -M is prefered for these types of diffs? Not sure.

On Mon, Feb 12, 2018 at 05:24:59PM +0530, Himanshu Jha wrote:
> +static int adis16201_probe(struct spi_device *spi)
> +{
> + struct iio_dev *indio_dev;
> + struct adis *st;
> + int ret;
> +
> + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + st = iio_priv(indio_dev);
> + spi_set_drvdata(spi, indio_dev);
> +
> + indio_dev->name = spi->dev.driver->name;
> + indio_dev->dev.parent = &spi->dev;
> + indio_dev->info = &adis16201_info;
> +
> + indio_dev->channels = adis16201_channels;
> + indio_dev->num_channels = ARRAY_SIZE(adis16201_channels);
> + indio_dev->modes = INDIO_DIRECT_MODE;
> +
> + ret = adis_init(st, indio_dev, spi, &adis16201_data);
> + if (ret)
> + return ret;
> +
> + ret = adis_setup_buffer_and_trigger(st, indio_dev, NULL);
> + if (ret)
> + return ret;

We should clean up the IRQ which we enabled in adis_init() instead of
returning directly.

> +
> + /* Get the device into a sane initial state */
> + ret = adis_initial_startup(st);
> + if (ret)
> + goto error_cleanup_buffer_trigger;
> +
> + ret = iio_device_register(indio_dev);
> + if (ret < 0)
> + goto error_cleanup_buffer_trigger;
> +
> + return 0;
> +
> +error_cleanup_buffer_trigger:
> + adis_cleanup_buffer_and_trigger(st, indio_dev);
> +
> + return ret;
> +}

Otherwise it looks fine to my not-an-iio-expert eye.

regards,
dan carpenter