From patchwork Thu Jan 20 18:32:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Davidlohr Bueso X-Patchwork-Id: 492391 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0KIXHhx012122 for ; Thu, 20 Jan 2011 18:33:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752104Ab1ATSdE (ORCPT ); Thu, 20 Jan 2011 13:33:04 -0500 Received: from hapkido.dreamhost.com ([66.33.216.122]:44084 "EHLO hapkido.dreamhost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753861Ab1ATSdB (ORCPT ); Thu, 20 Jan 2011 13:33:01 -0500 Received: from homiemail-a2.g.dreamhost.com (caiajhbdccac.dreamhost.com [208.97.132.202]) by hapkido.dreamhost.com (Postfix) with ESMTP id B50AE18608A for ; Thu, 20 Jan 2011 10:33:00 -0800 (PST) Received: from homiemail-a2.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a2.g.dreamhost.com (Postfix) with ESMTP id D16E2280062; Thu, 20 Jan 2011 10:32:20 -0800 (PST) Received: from [186.40.185.176] (unknown [186.40.185.176]) (Authenticated sender: smtp@zesaurus.cl) by homiemail-a2.g.dreamhost.com (Postfix) with ESMTPA id 84A87280061; Thu, 20 Jan 2011 10:32:18 -0800 (PST) Subject: [PATCH 3/3] hid: return -ENOMEM when memory allocation fails From: Davidlohr Bueso To: Jiri Kosina , linux-input@vger.kernel.org Cc: LKML Date: Thu, 20 Jan 2011 15:32:10 -0300 Message-ID: <1295548330.2089.13.camel@offworld> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 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 (demeter1.kernel.org [140.211.167.41]); Thu, 20 Jan 2011 18:33:18 +0000 (UTC) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index d678cf3..eb2251c 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -129,7 +129,7 @@ static int open_collection(struct hid_parser *parser, unsigned type) parser->device->collection_size * 2, GFP_KERNEL); if (collection == NULL) { dbg_hid("failed to reallocate collection array\n"); - return -1; + return -ENOMEM; } memcpy(collection, parser->device->collection, sizeof(struct hid_collection) * diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index af0a7c1..38513cc 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -894,7 +894,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force) } if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) - return -1; + return -ENOMEM; init_waitqueue_head(&hiddev->wait); INIT_LIST_HEAD(&hiddev->list);