[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <518384D1.8030802@metafoo.de>
Date: Fri, 03 May 2013 11:35:13 +0200
From: Lars-Peter Clausen <lars@...afoo.de>
To: Oskar Andero <oskar.andero@...il.com>
CC: linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
Jonathan Cameron <jic23@....ac.uk>
Subject: Re: [PATCHv3] iio: adc: add driver for MCP3204/08 12-bit ADC
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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists