From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: jikos@kernel.org, briannorris@chromium.org,
dianders@chromium.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] HID: i2c-hid: Fix error handling
Date: Tue, 28 Feb 2017 17:21:07 +0000 [thread overview]
Message-ID: <20170228172107.GD7064@mail.corp.redhat.com> (raw)
In-Reply-To: <20170219120759.11162-1-christophe.jaillet@wanadoo.fr>
On Feb 19 2017 or thereabouts, Christophe JAILLET wrote:
> According to error handling in this function, it is likely that some
> resources should be freed before returning.
> Replace 'return ret', with 'goto err'.
>
> While at it, remove some spaces at the beginning of the lines to be more
> consistent.
>
>
> Fixes: ead0687fe304a ("HID: i2c-hid: support regulator power on/off")
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Good catch.
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
> drivers/hid/i2c-hid/i2c-hid.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
> index d5288f3fb5ee..1a57ac2d8524 100644
> --- a/drivers/hid/i2c-hid/i2c-hid.c
> +++ b/drivers/hid/i2c-hid/i2c-hid.c
> @@ -1058,13 +1058,13 @@ static int i2c_hid_probe(struct i2c_client *client,
> }
>
> ihid->pdata.supply = devm_regulator_get(&client->dev, "vdd");
> - if (IS_ERR(ihid->pdata.supply)) {
> - ret = PTR_ERR(ihid->pdata.supply);
> - if (ret != -EPROBE_DEFER)
> - dev_err(&client->dev, "Failed to get regulator: %d\n",
> - ret);
> - return ret;
> - }
> + if (IS_ERR(ihid->pdata.supply)) {
> + ret = PTR_ERR(ihid->pdata.supply);
> + if (ret != -EPROBE_DEFER)
> + dev_err(&client->dev, "Failed to get regulator: %d\n",
> + ret);
> + goto err;
> + }
>
> ret = regulator_enable(ihid->pdata.supply);
> if (ret < 0) {
> --
> 2.9.3
>
next prev parent reply other threads:[~2017-02-28 17:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-19 12:07 [PATCH] HID: i2c-hid: Fix error handling Christophe JAILLET
2017-02-28 17:21 ` Benjamin Tissoires [this message]
2017-03-06 13:17 ` Jiri Kosina
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=20170228172107.GD7064@mail.corp.redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=briannorris@chromium.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dianders@chromium.org \
--cc=jikos@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox