From patchwork Thu Dec 11 12:51:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Wu X-Patchwork-Id: 5475861 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 25AAABEEA8 for ; Thu, 11 Dec 2014 12:52:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40F5C20149 for ; Thu, 11 Dec 2014 12:52:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51F7020160 for ; Thu, 11 Dec 2014 12:52:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932159AbaLKMwb (ORCPT ); Thu, 11 Dec 2014 07:52:31 -0500 Received: from lekensteyn.nl ([178.21.112.251]:45178 "EHLO lekensteyn.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933197AbaLKMvg (ORCPT ); Thu, 11 Dec 2014 07:51:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lekensteyn.nl; s=s2048-2014-q3; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=bSKUWEpI9bk4m7OF1PxMjgoxsc68Ytx5m/qyqMgnK6M=; b=rLBeMsYoencEK2ZC8XtWyR++q6du3Gux7WEVt24zW3hRtAO5dzkI/Eiclar/Ymu+UQb3yFoh45akz26FdZyYZK3LMUWokj1nt+paqcKzHZ74KFhijLNZoJb1XzapVRi15VfgrKhhCe5KhsrQEfE7QqBXOeENydiq8O6h1KZG6c1aNAaly8hITV4I1tQ6ViegCj7umd8pv6uKQF7iACa8OcqbsjGuL9/g684KwCVcnnvzw9EeL1HUMrydmqo/MdlUNuhkTj67Jfi3SHKqPijE9XoQQVyANV0Xq8YDVQyktTk6kZO4LEjMV2y//aNiaUwd++a5ThJPzr4wzlHPa6Zqtw==; Received: by lekensteyn.nl with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.80) (envelope-from ) id 1Xz3DG-00020h-Pj; Thu, 11 Dec 2014 13:51:23 +0100 From: Peter Wu To: Benjamin Tissoires , Jiri Kosina , Nestor Lopez Casado Cc: Peter Hutterer , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] HID: logitech-hidpp: do not return the name length Date: Thu, 11 Dec 2014 13:51:17 +0100 Message-Id: <1418302280-14794-2-git-send-email-peter@lekensteyn.nl> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418302280-14794-1-git-send-email-peter@lekensteyn.nl> References: <1418302280-14794-1-git-send-email-peter@lekensteyn.nl> X-Spam-Score: -0.0 (/) X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We do not make any use of the actual name length get through hidpp_get_device_name(). Original patch by Benjamin Tissoires, this patch also replaces a (now) unnecessary goto by return NULL. Signed-off-by: Peter Wu Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-logitech-hidpp.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 1a6395d..5066df8 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -461,7 +461,7 @@ static int hidpp_devicenametype_get_device_name(struct hidpp_device *hidpp, return count; } -static char *hidpp_get_device_name(struct hidpp_device *hidpp, u8 *name_length) +static char *hidpp_get_device_name(struct hidpp_device *hidpp) { u8 feature_type; u8 feature_index; @@ -473,28 +473,23 @@ static char *hidpp_get_device_name(struct hidpp_device *hidpp, u8 *name_length) ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_GET_DEVICE_NAME_TYPE, &feature_index, &feature_type); if (ret) - goto out_err; + return NULL; ret = hidpp_devicenametype_get_count(hidpp, feature_index, &__name_length); if (ret) - goto out_err; + return NULL; name = kzalloc(__name_length + 1, GFP_KERNEL); if (!name) - goto out_err; + return NULL; - *name_length = __name_length + 1; while (index < __name_length) index += hidpp_devicenametype_get_device_name(hidpp, feature_index, index, name + index, __name_length - index); return name; - -out_err: - *name_length = 0; - return NULL; } /* -------------------------------------------------------------------------- */ @@ -989,7 +984,6 @@ static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying) { struct hidpp_device *hidpp = hid_get_drvdata(hdev); char *name; - u8 name_length; if (use_unifying) /* @@ -999,7 +993,7 @@ static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying) */ name = hidpp_get_unifying_name(hidpp); else - name = hidpp_get_device_name(hidpp, &name_length); + name = hidpp_get_device_name(hidpp); if (!name) hid_err(hdev, "unable to retrieve the name of the device"); @@ -1053,7 +1047,6 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) bool connected = atomic_read(&hidpp->connected); struct input_dev *input; char *name, *devm_name; - u8 name_length; if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) wtp_connect(hdev, connected); @@ -1080,7 +1073,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) return; } - name = hidpp_get_device_name(hidpp, &name_length); + name = hidpp_get_device_name(hidpp); if (!name) { hid_err(hdev, "unable to retrieve the name of the device"); } else {