Skip to content

Commit

Permalink
HID: i2c-hid: Fix error handling
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Christophe JAILLET authored and Jiri Kosina committed Mar 6, 2017
1 parent 572d3c6 commit d3d9adf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/i2c-hid/i2c-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ static int i2c_hid_probe(struct i2c_client *client,
if (ret != -EPROBE_DEFER)
dev_err(&client->dev, "Failed to get regulator: %d\n",
ret);
return ret;
goto err;
}

ret = regulator_enable(ihid->pdata.supply);
Expand Down

0 comments on commit d3d9adf

Please sign in to comment.