From patchwork Tue Feb 7 19:40:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9560955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AACCB6047A for ; Tue, 7 Feb 2017 19:42:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DCAB283F6 for ; Tue, 7 Feb 2017 19:42:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92B7328485; Tue, 7 Feb 2017 19:42:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C1A2283F6 for ; Tue, 7 Feb 2017 19:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754230AbdBGTlJ (ORCPT ); Tue, 7 Feb 2017 14:41:09 -0500 Received: from mout.web.de ([217.72.192.78]:52106 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbdBGTlA (ORCPT ); Tue, 7 Feb 2017 14:41:00 -0500 Received: from [192.168.1.2] ([78.49.4.3]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Mb8sh-1cqO2C09k3-00Kgk9; Tue, 07 Feb 2017 20:40:51 +0100 Subject: [PATCH 02/18] HID: Delete an error message for a failed memory allocation in open_collection() To: linux-input@vger.kernel.org, Benjamin Tissoires , =?UTF-8?Q?Bruno_Pr=c3=a9mont?= , Jiri Kosina References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Tue, 7 Feb 2017 20:40:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:iNNwB0g4ri7Kx+nc6QoJg94Z1qXlh2mLSo2Yid3LGUbkB5kif7W /arP16hIr0ehedgbQYX70StR96MvqWW/iGbuwUWc0M/o0+3hotHehDkZ9eUXQmsGSnVEmsG 4OLixsK63PeCJku2N2BvXiWKbSQKrjK56vb6kt7lJA6GGg97jsxyjokVr7J3to48er8d4Vf kOiRyJpBt7RnhRirIb9Cg== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZS4Hd9MzB3I=:h3ueR+i0xtUcuWvKTh7ETm i/3Vperv8OxDU6Jbwsqx9xkoGUMdcxgv1/LTfG/fRqWcTnOgpGrPkjmO6eyOynfPsyR2lamBP H1I6VGSxrsWgJ2U3D4yCwOel3BvlJdlzwdbHctBL4+pBb/5usm6hXkv95jK4sj6BV8SMYnRBy U8o5dlY2sd0ds1O54P0kvtmyKxDhxpFI71raZ8J+DPuH+4EYdpDa6FfjcS0w01gTL0GD8WPy1 DplgU/5PwhYu91khYRBJ9kT4eDgknwJzgerQkEXQIt4eIdfywMrTksVA/2639OYrf8qeqR7lD xtkhmQ/8NrKw7pVmOHCJ4X2UTAcA2rj5YcVHt6PCJ1dorqwbyTpB3dvLjwjC/hT4onlaz3QgA ySF0RG5ISLXcPGbr7tF8u0hpUqZdX7/KKnfQbWkNcwqsMW5LnKGHAmUI9lM+HydeepXUSLaRU Dzpz7dVlEhK0RGHuN8mtRtMJgW7jKaQPmuyVkhJpHYSficqYWd2LaVNRxytZ8P8bkBOSi4Cjl R2qICSQkF7jZogcZtjVj2tY2sxvbzr1y+ZFytiCrJWtmBzoxMsbYiVebD6bjIHgIpH7pAJMVi SqMADIh3M2hTc2A39+qa5ZpQXOvvcBID/13LEy6GBZIe70EdZapVBBETqGndEILgjifJWT0Q2 8CDW1M0KtcbG1pJmpzVIshzo8ydmmm6LG1F5T8tE/Og3DuFL3FXcSjMwIcC3HkM/ObRBkCYzJ 5/OSoAQIfuoVLSOGPinzp3a0U1133OsdDlqES9GUHpxPaFxCszkIO+wais5aXr72Uis0/WCvW 4wCZ5ya Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 6 Feb 2017 18:42:26 +0100 The script "checkpatch.pl" pointed information out like the following. WARNING: Possible unnecessary 'out of memory' message Thus fix the affected source code place. Signed-off-by: Markus Elfring --- drivers/hid/hid-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 9b0a97bbde96..ffb7e5d4ee19 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -133,10 +133,9 @@ static int open_collection(struct hid_parser *parser, unsigned type) if (parser->device->maxcollection == parser->device->collection_size) { collection = kmalloc(sizeof(struct hid_collection) * parser->device->collection_size * 2, GFP_KERNEL); - if (collection == NULL) { - hid_err(parser->device, "failed to reallocate collection array\n"); + if (!collection) return -ENOMEM; - } + memcpy(collection, parser->device->collection, sizeof(struct hid_collection) * parser->device->collection_size);