aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/i2c-hid/i2c-hid.c
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>2012-12-04 10:27:48 -0500
committerJiri Kosina <jkosina@suse.cz>2012-12-05 05:04:28 -0500
commit317b204a131c36df564bd71214e9e18348a084c9 (patch)
treede65150b058c4b84e72952e5a7d82671cd9b1bf2 /drivers/hid/i2c-hid/i2c-hid.c
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/i2c-hid.c')
-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 be5126c281c3..e0d097deb067 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,
244 if (ret) { 244 if (ret) {
245 dev_err(&client->dev, 245 dev_err(&client->dev,
246 "failed to retrieve report from device.\n"); 246 "failed to retrieve report from device.\n");
247 return -EINVAL; 247 return ret;
248 } 248 }
249 249
250 return 0; 250 return 0;
@@ -289,7 +289,7 @@ static int i2c_hid_set_report(struct i2c_client *client, u8 reportType,
289 reportType, args, args_len, NULL, 0); 289 reportType, args, args_len, NULL, 0);
290 if (ret) { 290 if (ret) {
291 dev_err(&client->dev, "failed to set a report to device.\n"); 291 dev_err(&client->dev, "failed to set a report to device.\n");
292 return -EINVAL; 292 return ret;
293 } 293 }
294 294
295 return data_len; 295 return data_len;
@@ -333,7 +333,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
333 return 0; 333 return 0;
334} 334}
335 335
336static int i2c_hid_get_input(struct i2c_hid *ihid) 336static void i2c_hid_get_input(struct i2c_hid *ihid)
337{ 337{
338 int ret, ret_size; 338 int ret, ret_size;
339 int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); 339 int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
@@ -341,11 +341,11 @@ static int i2c_hid_get_input(struct i2c_hid *ihid)
341 ret = i2c_master_recv(ihid->client, ihid->inbuf, size); 341 ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
342 if (ret != size) { 342 if (ret != size) {
343 if (ret < 0) 343 if (ret < 0)
344 return ret; 344 return;
345 345
346 dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n", 346 dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n",
347 __func__, ret, size); 347 __func__, ret, size);
348 return ret; 348 return;
349 } 349 }
350 350
351 ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8; 351 ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8;
@@ -354,13 +354,13 @@ static int i2c_hid_get_input(struct i2c_hid *ihid)
354 /* host or device initiated RESET completed */ 354 /* host or device initiated RESET completed */
355 if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags)) 355 if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags))
356 wake_up(&ihid->wait); 356 wake_up(&ihid->wait);
357 return 0; 357 return;
358 } 358 }
359 359
360 if (ret_size > size) { 360 if (ret_size > size) {
361 dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", 361 dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
362 __func__, size, ret_size); 362 __func__, size, ret_size);
363 return -EIO; 363 return;
364 } 364 }
365 365
366 i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf); 366 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)
369 hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2, 369 hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2,
370 ret_size - 2, 1); 370 ret_size - 2, 1);
371 371
372 return 0; 372 return;
373} 373}
374 374
375static irqreturn_t i2c_hid_irq(int irq, void *dev_id) 375static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
@@ -429,8 +429,10 @@ static void i2c_hid_init_reports(struct hid_device *hid)
429 struct i2c_hid *ihid = i2c_get_clientdata(client); 429 struct i2c_hid *ihid = i2c_get_clientdata(client);
430 u8 *inbuf = kzalloc(ihid->bufsize, GFP_KERNEL); 430 u8 *inbuf = kzalloc(ihid->bufsize, GFP_KERNEL);
431 431
432 if (!inbuf) 432 if (!inbuf) {
433 dev_err(&client->dev, "can not retrieve initial reports\n");
433 return; 434 return;
435 }
434 436
435 list_for_each_entry(report, 437 list_for_each_entry(report,
436 &hid->report_enum[HID_INPUT_REPORT].report_list, list) 438 &hid->report_enum[HID_INPUT_REPORT].report_list, list)
@@ -714,9 +716,7 @@ static int i2c_hid_hidinput_input_event(struct input_dev *dev,
714 return -1; 716 return -1;
715 } 717 }
716 718
717 hid_set_field(field, offset, value); 719 return hid_set_field(field, offset, value);
718
719 return 0;
720} 720}
721 721
722static struct hid_ll_driver i2c_hid_ll_driver = { 722static struct hid_ll_driver i2c_hid_ll_driver = {