From patchwork Fri Sep 27 15:59:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 2955701 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F33BB9F288 for ; Fri, 27 Sep 2013 16:00:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC2AD20295 for ; Fri, 27 Sep 2013 16:00:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C05262027C for ; Fri, 27 Sep 2013 16:00:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752377Ab3I0QAS (ORCPT ); Fri, 27 Sep 2013 12:00:18 -0400 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 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r8RFxqW7014418 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 Sep 2013 15:59:53 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8RFxplH015114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 27 Sep 2013 15:59:51 GMT Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8RFxo4g027880; Fri, 27 Sep 2013 15:59:50 GMT Received: from mwanda (/41.202.233.186) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 27 Sep 2013 08:59:49 -0700 Date: Fri, 27 Sep 2013 18:59:41 +0300 From: Dan Carpenter To: Joseph Salisbury Cc: Jiri Kosina , list@osuosl.org, Haiyang Zhang , LKML , open@osuosl.org, HID CORE LAYER , devel@linuxdriverproject.org, thomas@m3y3r.de Subject: Re: [v3.11][Regression] HID: hyperv: convert alloc+memcpy to memdup 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-Disposition: inline In-Reply-To: <20130927152412.GF6192@mwanda> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: --- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);