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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to