Received: by 10.223.176.5 with SMTP id f5csp875903wra; Tue, 6 Feb 2018 08:49:04 -0800 (PST) X-Google-Smtp-Source: AH8x226NhsRpo1KXSh84G5KASVDG1IG8lvvcwjD6b14F86jdbsGp4VY59zz7DieGykocyeOmejcQ X-Received: by 2002:a17:902:b496:: with SMTP id y22-v6mr2953025plr.206.1517935744572; Tue, 06 Feb 2018 08:49:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517935744; cv=none; d=google.com; s=arc-20160816; b=HoL2xP4Z3qfRtY1njQuXhDDANDfpTppxrnyvHzTzFau2iPV58J6im2BWmYPy1YNTN6 g7SmJePd4//yN79BycO0x/pUnV2HKK5zaQBE8Koy0Mr3rRY3nkX1MaNLE75Qb/FE/UVd 4+X77uodC09pUf7UBhvngAchcoHHcJCbvpGlBEG+F4abnGi0n+w0n2f6tkHVejSlIUKd TReOCFQgPOViTTblMbIzKjtkLFGIbsVq84RuZOd00JTOghBF3jHbnJGGe7taTAIEBnry JTFcITulm9iidf/yZnKRLWiBI92mxRWsKCQ7UXTP0XN2fSeco2J1uAQz4k2NM6iFfei7 fG9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to:arc-authentication-results; bh=QZLAdeQJ82JFMQlW/0jmFKdAgR3r4puT0CLnE9N+Yak=; b=Mp+VxsR2VIXQI5JTymhUGS9NwPDYy/fpwbulg2SxQqk9HJAgcjIl7WZ50KNQ6FRqE2 bSFtNE0V63meNy/wO9eSeKlgC1y1idS9hHS4tmHchATnbjRn2CvfRnAGLmQ7ut/EugFH 9TaaEoV3wllAAtc1+0ZGxi5AGYbfpE+6I/Xutq6XiUZLGymq2GBYAHEV6s/LhTo0tK/H uN+bO8mkftLQ3j6IAwzqnfYeos5GptqBQsf7ZV+wdhEmyviuN8tl6KeAhFA/Ti/hqnhw JmFK/OUi/i8rxpuCQ1fAXs3xkYW2fiVN3OwmyQg7/Q+eZ1m2T0OP6R4EFlTHIvDGilsV n14g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11si959364pgq.634.2018.02.06.08.48.50; Tue, 06 Feb 2018 08:49:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752754AbeBFQrl (ORCPT + 99 others); Tue, 6 Feb 2018 11:47:41 -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-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.16.1