[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOMZO5DT-cRYpCWShQqE7oX7v262s6K1G=R3PfBHs9RHXiiH6A@mail.gmail.com>
Date: Mon, 10 Dec 2018 12:46:17 -0200
From: Fabio Estevam <festevam@...il.com>
To: Yongcai Huang <anson.huang@....com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald <pmeerw@...erw.net>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
rtresidd@...ctromag.com.au,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Leonard Crestez <leonard.crestez@....com>, martink@...teo.de,
linux-iio@...r.kernel.org,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
NXP Linux Team <linux-imx@....com>
Subject: Re: [PATCH V2 2/2] iio: accell: mma8452: add optional vdd/vddio
regulator operation support
On Mon, Dec 10, 2018 at 5:25 AM Anson Huang <anson.huang@....com> wrote:
> @@ -1533,6 +1536,27 @@ static int mma8452_probe(struct i2c_client *client,
> data->client = client;
> mutex_init(&data->lock);
> data->chip_info = match->data;
> + data->vdd_reg = devm_regulator_get_optional(&client->dev, "vdd");
> + if (!IS_ERR(data->vdd_reg)) {
> + ret = regulator_enable(data->vdd_reg);
> + if (ret) {
> + dev_err(&client->dev, "failed to enable VDD regulator\n");
> + return ret;
> + }
> + } else if (data->vdd_reg == ERR_PTR(-EPROBE_DEFER)) {
> + return -EPROBE_DEFER;
> + }
> +
> + data->vddio_reg = devm_regulator_get_optional(&client->dev, "vddio");
> + if (!IS_ERR(data->vddio_reg)) {
> + ret = regulator_enable(data->vddio_reg);
> + if (ret) {
> + dev_err(&client->dev, "failed to enable VDDIO regulator\n");
> + return ret;
As mentioned in your other patch: you should disable the previously
enabled regulator in the error path.
Powered by blists - more mailing lists