HID: core: Delete an error message for a failed memory allocation in open_collection()
Subsystems (2)
PATCH 1/1 HID: core: Delete an error message for a failed memory allocation in open_collection()
From: Markus Elfring <[email protected]>
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 <[email protected]>
--- drivers/hid/hid-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/hid/hid-core.c +2 -3
@@ -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);
Signature · 1 line
2.16.1