From patchwork Tue Feb 6 16:47:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10203371 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 1AB8560247 for ; Tue, 6 Feb 2018 16:47:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0693428A5F for ; Tue, 6 Feb 2018 16:47:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF39E28BE2; Tue, 6 Feb 2018 16:47:35 +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 9337F28A5F for ; Tue, 6 Feb 2018 16:47:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752731AbeBFQre (ORCPT ); Tue, 6 Feb 2018 11:47:34 -0500 Received: from mout.web.de ([212.227.15.14]:57886 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752370AbeBFQrV (ORCPT ); Tue, 6 Feb 2018 11:47:21 -0500 Received: from [192.168.1.2] ([92.225.242.179]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LaTdP-1f8Z02266p-00mM6B; Tue, 06 Feb 2018 17:47:13 +0100 To: linux-input@vger.kernel.org, Benjamin Tissoires , Jiri Kosina Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] HID: core: Delete an error message for a failed memory allocation in open_collection() Message-ID: <92b58eb4-e68b-f7eb-d99e-5d0993ad18b6@users.sourceforge.net> Date: Tue, 6 Feb 2018 17:47:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Language: en-US X-Provags-ID: V03:K0:/bnFmdwn6grJDi49/6+5I1JpzvAXCsmXqCVE16ZNXe1PwGv+mMY 5av1hZ+SZrte330v3jIyJfILHYjbuZwnRivNs7JzwnB26qEsf3XpC8UKZ7ShD7KHJvCgnya Vbtv1zzxJN3O5W3QNMlbEM0fx875e7zBRRSnavIGJwffsNtYhL+I8i4KdZgCZXCG4VnwgIl 8rhTb4TMw1MNbvpCmmBlg== X-UI-Out-Filterresults: notjunk:1; V01:K0:ggFKpirjmBM=:9oDnknvedcUK/Ws4I7LIUw vd0pz0wtqghkXZNCgL8+RVLe4wGDhWYgy/tnJJNRiXZeuaHTBxisR0XQyXh4b+ChW+G6NdkiI D6Z4gERKmqAPsk7zRotvEgoQ8CGk9BqxQD5C3Yolwavb8Z+0wHbz1clPq9qABzEl0AarsFxhz ccweaXcZqJSNC/ksouXj0y9RPbe+/+Z243MxcPgiL9SGThO6yYnDPKQnXxxgbQJ+ne0MC+Y53 WrFWLAzcyDLscJURpmv6gFzSGfWkJbLPuGgAMqzAkkGlYpF0q2mEUdJc5R3089ChmO+wmF/PL UHGwFFNNt5VzxxqmUnoMpiaHQidgRHOBTxRoQ3DMPG1T44fsd7acYefdZ3fwlWXXMbxUqU7qO Ge/VnNI2dwVgyQIsQbIgqaNxddgJKXgZVtGiUxFAPKIdoIFZVbJERFAAUOnEX13lsmqwncWDD vLNKSTaR+B3Gx6VqcRcZxLMIwptDBlIu2lzNwdzcOdHsngDn5daemArGM9BoxFmN/EJsnOBkC 5bBdSrSxFq5oB5dJ6GzOg9amaHhAaktbE+p96agMTOI3PMcZpL7XpXTy42jQVetsS2I3UjhlI PhQuKT6E1dgn0Vhcbb5sfDxCbEnPb7BvV8C0siaNbJtgTsb3NK8iypF3rW2mhLrWIagJ+5R9b FjsQ+5530mihmvrgkEerkLJI2I3oMwpQ9Ua6e3ZxLPFY5QQj0YhZ3wwl+BCWvf0ZegOnbldNV UOgzHgDsNzSIBmDpBCKicxterdyWy3YpqRHjs9tkB8fIh6zPsmakKfTZmvp5EUbLPS6PXKbrF 15KKCfs/QZg23ON5XoGJ4ov1M+tx4fC0c1xRC9F8obIokUM1Ug= 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: Tue, 6 Feb 2018 17:40:51 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. 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 c2560aae5542..5ad5f52f6f9b 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);