Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1589642

Re: [PATCH] HID: i2c-hid: Fix error handling

From Benjamin Tissoires <benjamin.tissoires@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] HID: i2c-hid: Fix error handling
Date 2017-02-28 18:30 +0100
Message-ID <tfTL4-7Al-7@gated-at.bofh.it> (permalink)
References <tcyD8-7hd-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] HID: i2c-hid: Fix error handling Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-02-19 13:20 +0100
  Re: [PATCH] HID: i2c-hid: Fix error handling Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-02-28 18:30 +0100
  Re: [PATCH] HID: i2c-hid: Fix error handling Jiri Kosina <jikos@kernel.org> - 2017-03-06 14:50 +0100

csiph-web