From: Lars-Peter Clausen <lars@metafoo.de>
To: Oskar Andero <oskar.andero@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
Jonathan Cameron <jic23@cam.ac.uk>
Subject: Re: [PATCHv3] iio: adc: add driver for MCP3204/08 12-bit ADC
Date: Fri, 03 May 2013 11:35:13 +0200 [thread overview]
Message-ID: <518384D1.8030802@metafoo.de> (raw)
In-Reply-To: <1367571310-20491-1-git-send-email-oskar.andero@gmail.com>
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;
> +}
[...]
prev parent reply other threads:[~2013-05-03 9:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 8:55 [PATCHv3] iio: adc: add driver for MCP3204/08 12-bit ADC Oskar Andero
2013-05-03 9:35 ` Lars-Peter Clausen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=518384D1.8030802@metafoo.de \
--to=lars@metafoo.de \
--cc=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oskar.andero@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.