summaryrefslogtreecommitdiffstats
path: root/drivers/hid/i2c-hid
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>2012-12-04 16:27:48 +0100
committerJiri Kosina <jkosina@suse.cz>2012-12-05 11:04:28 +0100
commit317b204a131c36df564bd71214e9e18348a084c9 (patch)
treede65150b058c4b84e72952e5a7d82671cd9b1bf2 /drivers/hid/i2c-hid
parent6bf6c8bf2ba6548c38eeaccb735992660c4bbaeb (diff)
HID: i2c-hid: fix return paths
Forwards appropriate return values. As noone use the error returned by i2c_hid_get_input, let's make it returning void. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/i2c-hid')
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index be5126c281c..e0d097deb06 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -244,7 +244,7 @@ static int i2c_hid_get_report(struct i2c_client *client, u8 reportType,
if (ret) {
dev_err(&client->dev,
"failed to retrieve report from device.\n");
- return -EINVAL;
+ return ret;
}
return 0;
@@ -289,7 +289,7 @@ static int i2c_hid_set_report(struct i2c_client *client, u8 reportType,
reportType, args, args_len, NULL, 0);
if (ret) {
dev_err(&client->dev, "failed to set a report to device.\n");
- return -EINVAL;
+ return ret;
}
return data_len;
@@ -333,7 +333,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
return 0;
}
-static int i2c_hid_get_input(struct i2c_hid *ihid)
+static void i2c_hid_get_input(struct i2c_hid *ihid)
{
int ret, ret_size;
int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
@@ -341,11 +341,11 @@ static int i2c_hid_get_input(struct i2c_hid *ihid)
ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
if (ret != size) {
if (ret < 0)
- return ret;
+ return;
dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n",
__func__, ret, size);
- return ret;
+ return;
}
ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8;
@@ -354,13 +354,13 @@ static int i2c_hid_get_input(struct i2c_hid *ihid)
/* host or device initiated RESET completed */
if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags))
wake_up(&ihid->wait);
- return 0;
+ return;
}
if (ret_size > size) {
dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
__func__, size, ret_size);
- return -EIO;
+ return;
}
i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
@@ -369,7 +369,7 @@ static int i2c_hid_get_input(struct i2c_hid *ihid)
hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2,
ret_size - 2, 1);
- return 0;
+ return;
}
static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
@@ -429,8 +429,10 @@ static void i2c_hid_init_reports(struct hid_device *hid)
struct i2c_hid *ihid = i2c_get_clientdata(client);
u8 *inbuf = kzalloc(ihid->bufsize, GFP_KERNEL);
- if (!inbuf)
+ if (!inbuf) {
+ dev_err(&client->dev, "can not retrieve initial reports\n");
return;
+ }
list_for_each_entry(report,
&hid->report_enum[HID_INPUT_REPORT].report_list, list)
@@ -714,9 +716,7 @@ static int i2c_hid_hidinput_input_event(struct input_dev *dev,
return -1;
}
- hid_set_field(field, offset, value);
-
- return 0;
+ return hid_set_field(field, offset, value);
}
static struct hid_ll_driver i2c_hid_ll_driver = {