From patchwork Tue Dec 4 15:27:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 1838841 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 607A63FCA5 for ; Tue, 4 Dec 2012 15:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753233Ab2LDPag (ORCPT ); Tue, 4 Dec 2012 10:30:36 -0500 Received: from mail-wg0-f46.google.com ([74.125.82.46]:50038 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751795Ab2LDP2Z (ORCPT ); Tue, 4 Dec 2012 10:28:25 -0500 Received: by mail-wg0-f46.google.com with SMTP id dr13so2395288wgb.1 for ; Tue, 04 Dec 2012 07:28:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=3TJOY8JfQ1d2kfhHIzSu41cZ3XGEyxnDnNox8is2EY0=; b=FQ8dp+bdWfOdbqLIMjLgY7eDEujKLvgFaBGRUuU/DxQlKwqSL0kGGJYaECXbFwxT3Y uqFt7wCyt947cSAbfjzQn0kVSUnxLQySd2X5/87PomnV9p/ke3hVN+mDfO5pdBsNm4oa BXYD2I1tu39Rd/HsKjQegCOVxu2l2Ud6XdCG8lIXmV0V4jjqsxMPRz2Tv7WYiRltGPqU T3v/JkIDNkuKW7UZmJJ7yAsJeOsfeHCHi0UP2ZvgO2WQ0cky3NetzOT4Xlg46596BK8L 83S8tcojD8YGcvvywyTXc1aNeOif3dDeToq1VOFpkTLcqNq6RGArBhQ2wVQjaOMbtRHu DV4g== Received: by 10.216.194.170 with SMTP id m42mr4793730wen.30.1354634904865; Tue, 04 Dec 2012 07:28:24 -0800 (PST) Received: from localhost.localdomain.com (lan31-8-82-247-176-67.fbx.proxad.net. [82.247.176.67]) by mx.google.com with ESMTPS id p3sm15443846wic.8.2012.12.04.07.28.23 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 04 Dec 2012 07:28:24 -0800 (PST) From: Benjamin Tissoires To: Benjamin Tissoires , Jiri Kosina , Jean Delvare , 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 Message-Id: <1354634875-5182-8-git-send-email-benjamin.tissoires@gmail.com> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1354634875-5182-1-git-send-email-benjamin.tissoires@gmail.com> References: <1354634875-5182-1-git-send-email-benjamin.tissoires@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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 Reviewed-by: Jean Delvare --- 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 = {