From: Benjamin Tissoires <benjamin.tissoires@gmail.com>
To: Benjamin Tissoires <benjamin.tissoires@gmail.com>,
Jiri Kosina <jkosina@suse.cz>, Jean Delvare <khali@linux-fr.org>,
linux-input@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 07/14] HID: i2c-hid: fix return paths
Date: Tue, 4 Dec 2012 16:27:48 +0100 [thread overview]
Message-ID: <1354634875-5182-8-git-send-email-benjamin.tissoires@gmail.com> (raw)
In-Reply-To: <1354634875-5182-1-git-send-email-benjamin.tissoires@gmail.com>
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>
---
drivers/hid/i2c-hid/i2c-hid.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 4452611..d6fdb3e 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -245,7 +245,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;
@@ -290,7 +290,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;
@@ -334,7 +334,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);
@@ -342,11 +342,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;
@@ -355,13 +355,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);
@@ -370,7 +370,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)
@@ -430,8 +430,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)
@@ -715,9 +717,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 = {
--
1.8.0.1
next prev parent reply other threads:[~2012-12-04 15:27 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-04 15:27 [PATCH 00/14] i2c-hid cleanup and bug fixes Benjamin Tissoires
2012-12-04 15:27 ` [PATCH 02/14] HID: i2c-hid: fix memory corruption due to missing hid declaration Benjamin Tissoires
[not found] ` <1354634875-5182-3-git-send-email-benjamin.tissoires-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-04 21:42 ` Jean Delvare
[not found] ` <20121204224205.58420e3f-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-05 10:10 ` Benjamin Tissoires
[not found] ` <CAN+gG=Hk+BCexxUif2Eqt9sQ4-_K1dfiUx5xD52-Hj2k5hUPug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-05 10:13 ` Jiri Kosina
2012-12-04 15:27 ` [PATCH 03/14] HID: i2c-hid: enhance Kconfig Benjamin Tissoires
2012-12-04 21:43 ` Jean Delvare
2012-12-05 9:55 ` Jiri Kosina
2012-12-04 15:27 ` [PATCH 04/14] HID: i2c-hid: fix checkpatch.pl warning Benjamin Tissoires
2012-12-04 21:43 ` Jean Delvare
[not found] ` <20121204224349.2cefa121-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-05 9:55 ` Jiri Kosina
2012-12-04 15:27 ` [PATCH 05/14] HID: i2c-hid: fix i2c_hid_dbg macro Benjamin Tissoires
[not found] ` <1354634875-5182-6-git-send-email-benjamin.tissoires-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-04 21:49 ` Jean Delvare
[not found] ` <20121204224950.6ebd7346-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-05 9:56 ` Jiri Kosina
2012-12-04 15:27 ` [PATCH 06/14] HID: i2c-hid: remove unused static declarations Benjamin Tissoires
2012-12-04 21:51 ` Jean Delvare
[not found] ` <20121204225132.2b7b6f6f-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-05 10:03 ` Jiri Kosina
2012-12-04 15:27 ` Benjamin Tissoires [this message]
2012-12-05 9:47 ` [PATCH 07/14] HID: i2c-hid: fix return paths Jean Delvare
2012-12-05 10:05 ` Jiri Kosina
2012-12-04 15:27 ` [PATCH 08/14] HID: i2c-hid: fix error messages Benjamin Tissoires
[not found] ` <1354634875-5182-9-git-send-email-benjamin.tissoires-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-05 9:51 ` Jean Delvare
[not found] ` <20121205105158.666a19a8-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-12-05 10:07 ` Jiri Kosina
2012-12-04 15:27 ` [PATCH 09/14] HID: i2c-hid: i2c_hid_get_report may fail Benjamin Tissoires
2012-12-05 9:59 ` Jean Delvare
2012-12-05 10:07 ` Benjamin Tissoires
[not found] ` <1354634875-5182-10-git-send-email-benjamin.tissoires-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-05 10:28 ` Jiri Kosina
2012-12-04 15:27 ` [PATCH 10/14] HID: i2c-hid: reorder allocation/free of buffers Benjamin Tissoires
[not found] ` <1354634875-5182-11-git-send-email-benjamin.tissoires-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-05 10:10 ` Jean Delvare
2012-12-05 10:12 ` Benjamin Tissoires
2012-12-04 15:27 ` [PATCH 11/14] HID: i2c-hid: remove unneeded test in i2c_hid_remove Benjamin Tissoires
2012-12-05 10:13 ` Jean Delvare
2012-12-05 10:30 ` Jiri Kosina
[not found] ` <1354634875-5182-1-git-send-email-benjamin.tissoires-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-04 15:27 ` [PATCH 01/14] HID: i2c-hid: change I2C name Benjamin Tissoires
2012-12-04 16:07 ` Jean Delvare
2012-12-05 9:52 ` Jiri Kosina
2012-12-04 15:27 ` [PATCH 12/14] HID: i2c-hid: remove extra .irq field in struct i2c_hid Benjamin Tissoires
2012-12-05 10:29 ` Jean Delvare
2012-12-04 15:27 ` [PATCH 13/14] HID: i2c-hid: also call i2c_hid_free_buffers in i2c_hid_remove Benjamin Tissoires
2012-12-05 10:27 ` Jiri Kosina
2012-12-05 10:32 ` Jean Delvare
2012-12-04 15:27 ` [PATCH 14/14] HID: i2c-hid: fix i2c_hid_get_raw_report count mismatches Benjamin Tissoires
2012-12-05 10:40 ` Benjamin Tissoires
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=1354634875-5182-8-git-send-email-benjamin.tissoires@gmail.com \
--to=benjamin.tissoires@gmail.com \
--cc=jkosina@suse.cz \
--cc=khali@linux-fr.org \
--cc=linux-i2c@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;
as well as URLs for NNTP newsgroup(s).