Re: [PATCHv3] iio: adc: add driver for MCP3204/08 12-bit ADC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/03/2013 10:55 AM, Oskar Andero wrote:
[...]
> +
> +struct mcp320x {
> +	struct spi_device *spi;
> +	struct spi_message msg;
> +	struct spi_transfer transfer[2];
> +
> +	u8 tx_buf;
> +	u8 rx_buf[2];
> +
> +	struct regulator *reg;
> +	unsigned int ref_mv;

ref_mv looks unused.

> +
> +	struct mutex lock;
> +};
> +
[..]
> +static int mcp320x_probe(struct spi_device *spi)
> +{
[...]
> +
> +	ret = regulator_enable(adc->reg);
> +	if (ret < 0)
> +		goto reg_free;

You shouldn't disable the regulator if enabling it failed.

> +
> +	mutex_init(&adc->lock);
> +
> +	ret = iio_device_register(indio_dev);
> +	if (ret < 0)
> +		goto reg_free;
> +
> +	return 0;
> +
> +reg_free:
> +	regulator_disable(adc->reg);
> +	regulator_put(adc->reg);
> +iio_free:
> +	iio_device_free(indio_dev);
> +
> +	return ret;
> +}
[...]

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux