Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3473636pxy; Mon, 26 Apr 2021 02:36:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqJ0HSzMuxlfu3eAJddFGfV91NZhiYNwZWP56j1Wc3iO5jEANYGBBGdx0EaNBhc4FODkef X-Received: by 2002:a50:f396:: with SMTP id g22mr1463120edm.197.1619429812082; Mon, 26 Apr 2021 02:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619429812; cv=none; d=google.com; s=arc-20160816; b=KErY88Ci1Lkdjk/xoYjw1VzVtkCVVblf/Y0/Ag0hp/YuCStClipLcQPYQHI2A34niu 5vxLyMSdnc3e7tCfYqhu2w+9UDhwnUpQFhAbu2XcbBRbXChCkVrzfGq6o6ciGTow0OR/ Vc9ndy2ayT9d9aEyzzIhg7Cu66d4tE7Saicx2ItYP2X8+pmTTvEk0f4tSa8KwwRIn+wn L0WcRMO2ZF3SOuKNEfAvpd0i+SHtnBnh34Oot1tZc3LMxaGHoxjy0sa8xvVe1Fx6eGam o9oZTYgW3/mOUMAocveesPWX9mYI/YQnlu5Xuaae3SGrhT8YG13hxoxhzDJJb1MMK6qV WoIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=2IsiOqICO7/2YONFHJW3CQLG1a8xIrN8jT2h9JvcChI=; b=zC1nB88uk+NWaV1Nd2SjnU4YgVVDuH1dD4wyVQUrhtVe9SBnQbtMq4trOkaMeR3+zQ 7FF3LRhuQVddfGPkx4LRK87+CebqqUhl7COJ7i/e90Vkcs48l/t7LmFdwQwu24K9kgMF YQA3X5xcdAeWiLlAEz/prm7zQtArds9EL5VWX50FYfePH7XNjYrkeh5XaG/OjHBz0fQj uhXWO0R4IKdXPywwfIkg+kgRTmlNaJZQI2WqXQJ7htEFJvhCYWxrAJFQZALpHP16jA5Z 0hpOHgedTv4pMB9oH8XC72vUHYXWtVzgCGJR1cyPJgn/8sxJ660ZV7HiD5Rv78Rgn2qt pEJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb34si1064462ejc.697.2021.04.26.02.36.28; Mon, 26 Apr 2021 02:36:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232633AbhDZJgM (ORCPT + 99 others); Mon, 26 Apr 2021 05:36:12 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:51732 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbhDZJgL (ORCPT ); Mon, 26 Apr 2021 05:36:11 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0UWpMk66_1619429727; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0UWpMk66_1619429727) by smtp.aliyun-inc.com(127.0.0.1); Mon, 26 Apr 2021 17:35:28 +0800 From: Yang Li To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, linux-usb@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH] HID: hiddev: return -ENOMEM when kmalloc failed Date: Mon, 26 Apr 2021 17:35:26 +0800 Message-Id: <1619429726-54768-1-git-send-email-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver is using -1 instead of the -ENOMEM defined macro to specify that a buffer allocation failed. Using the correct error code is more intuitive. Smatch tool warning: drivers/hid/usbhid/hiddev.c:894 hiddev_connect() warn: returning -1 instead of -ENOMEM is sloppy No functional change, just more standardized. Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/hid/usbhid/hiddev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 45e0b1c..88020f3 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -891,7 +891,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); -- 1.8.3.1