From patchwork Thu May 26 08:50:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 820172 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4Q8p4fs014370 for ; Thu, 26 May 2011 08:51:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757075Ab1EZIuv (ORCPT ); Thu, 26 May 2011 04:50:51 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:63619 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756693Ab1EZIut (ORCPT ); Thu, 26 May 2011 04:50:49 -0400 Received: by bwz15 with SMTP id 15so253779bwz.19 for ; Thu, 26 May 2011 01:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=B9fBoDwesSZqoBwy5q5ej4t039N1eSrvXJPZ/ylmxaQ=; b=OfPNThUHgjic3YOKFPkPIGCl06kqCFfgq/2+t1VxkFBm084VoXtpSz4H7dymrUtw+N lmucsoW04uWdIRABCmtOxUtZJM5lp6WKQmy1d0AVGubTVNx1DEF/wLZA0FlUI5rKVOuf TC7nXBY7x6xQQF7jeLOvghqFY5/PbZwjh88Ms= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=VmJA4u1t3QksanOP8YtI3xCIh2dAftH1T/Ta7PjZb7dKmN4gg5hqIBDdNXCmZNkeB6 W3MZPGEdbKxlIiFuW5ka0fWm5axlL0cMSYkAyT6cCEC3HcuMXE/5sdXF7SF8NQjR+4HK JLNciU224GidlqI7Gk26SGknGzx/qNIAAOtLg= Received: by 10.204.81.203 with SMTP id y11mr393999bkk.124.1306399847708; Thu, 26 May 2011 01:50:47 -0700 (PDT) Received: from shale.localdomain ([212.49.88.34]) by mx.google.com with ESMTPS id z1sm281138bka.20.2011.05.26.01.50.43 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2011 01:50:47 -0700 (PDT) Date: Thu, 26 May 2011 11:50:18 +0300 From: Dan Carpenter To: Jiri Kosina Cc: "open list:USB HID/HIDBP DRI..." , "open list:HID CORE LAYER" , kernel-janitors@vger.kernel.org Subject: [patch 2/2] usbhid: fix some error codes in hiddev_connect() Message-ID: <20110526085018.GE14591@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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.6 (demeter2.kernel.org [140.211.167.43]); Thu, 26 May 2011 08:51:04 +0000 (UTC) Returning -1 is -EPERM which is inappropriate here. Signed-off-by: Dan Carpenter --- 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/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index b2f9a3a..80b8e76 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -890,8 +890,9 @@ int hiddev_connect(struct hid_device *hid, unsigned int force) return -1; } - if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) - return -1; + hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL); + if (!hiddev) + return -ENOMEM; init_waitqueue_head(&hiddev->wait); INIT_LIST_HEAD(&hiddev->list); @@ -905,7 +906,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force) hid_err(hid, "Not able to get a minor for this device\n"); hid->hiddev = NULL; kfree(hiddev); - return -1; + return retval; } return 0; }