From patchwork Wed Mar 31 12:05:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 89932 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2VC5Dwc000965 for ; Wed, 31 Mar 2010 12:05:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932479Ab0CaMFL (ORCPT ); Wed, 31 Mar 2010 08:05:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54502 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932204Ab0CaMFK (ORCPT ); Wed, 31 Mar 2010 08:05:10 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 36D428655F; Wed, 31 Mar 2010 14:05:09 +0200 (CEST) Date: Wed, 31 Mar 2010 14:05:08 +0200 (CEST) From: Jiri Kosina To: Octoploid Cc: Dmitry Torokhov , linux-input@vger.kernel.org Subject: Re: Logitech M705 thumb button In-Reply-To: <319012f1003300602q708563ebo90b30c8d8b15e938@mail.gmail.com> Message-ID: References: <20100330065625.GC12764@core.coreip.homeip.net> <319012f1003300033k254715dao7f9a807615df36df@mail.gmail.com> <319012f1003300602q708563ebo90b30c8d8b15e938@mail.gmail.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 31 Mar 2010 12:05:14 +0000 (UTC) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 368fbb0..c49aaa2 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1096,20 +1096,11 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i goto nomem; } - snprintf(buf, HID_DEBUG_BUFSIZE - 1, - "\nreport (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un"); - hid_debug_event(hid, buf); - - report = hid_get_report(report_enum, data); - if (!report) { - kfree(buf); - return -1; - } - /* dump the report */ snprintf(buf, HID_DEBUG_BUFSIZE - 1, - "report %d (size %u) = ", report->id, size); + "\nreport (size %u) (%snumbered) = ", size, report_enum->numbered ? "" : "un"); hid_debug_event(hid, buf); + for (i = 0; i < size; i++) { snprintf(buf, HID_DEBUG_BUFSIZE - 1, " %02x", data[i]); @@ -1117,6 +1108,13 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i } hid_debug_event(hid, "\n"); + report = hid_get_report(report_enum, data); + + if (!report) { + kfree(buf); + return -1; + } + kfree(buf); nomem: