From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [v3.11][Regression] HID: hyperv: convert alloc+memcpy to memdup Date: Fri, 27 Sep 2013 18:59:41 +0300 Message-ID: <20130927155941.GG6247@mwanda> References: <5237430B.5040009@canonical.com> <20130916203824.GP25896@mwanda> <52376ED9.5080208@canonical.com> <20130916210503.GQ25896@mwanda> <5237A5D5.8010006@canonical.com> <52432152.3030100@canonical.com> <52459942.3020600@canonical.com> <20130927152412.GF6192@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from aserp1040.oracle.com ([141.146.126.69]:38258 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752087Ab3I0QAR (ORCPT ); Fri, 27 Sep 2013 12:00:17 -0400 Content-Disposition: inline In-Reply-To: <20130927152412.GF6192@mwanda> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Joseph Salisbury Cc: Jiri Kosina , list@osuosl.org, Haiyang Zhang , LKML , open@osuosl.org, HID CORE LAYER , devel@linuxdriverproject.org, thomas@m3y3r.de On Fri, Sep 27, 2013 at 06:24:12PM +0300, Dan Carpenter wrote: > > It looks like magicmouse_raw_event() returns 1 on success and 0 on > failure. Fixing the return codes is a good idea but it won't fix the oops. What's the point of returning 1 and 0? In the current code no one cares and both are treated the same. Also if we decide to fix this instead of reverting the we could do this cleanup as well: diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index b8470b1..868ebaa 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1417,10 +1417,8 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { ret = hdrv->raw_event(hid, report, data, size); - if (ret < 0) { - ret = ret < 0 ? ret : 0; + if (ret < 0) goto unlock; - } } ret = hid_report_raw_event(hid, type, data, size, interrupt);