Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1931773rdf; Sun, 5 Nov 2023 22:08:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IG16LZA98bAEevz1cNPazLAyjQJ3QPg+RhkFrF/oANhHGI3g2+uTGhyvI8XvNX0L+ribitM X-Received: by 2002:a05:6a20:e107:b0:169:3769:2739 with SMTP id kr7-20020a056a20e10700b0016937692739mr29617805pzb.14.1699250925896; Sun, 05 Nov 2023 22:08:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699250925; cv=none; d=google.com; s=arc-20160816; b=XX6YG2qtkYJAXawO91SaukD5wKg7K4Ke4e4EuMrqIf/ZVHOb5UFvy+LUu2C6o77NN4 FdbT7nWns34CmAMSylwIRRuOM4UoDfwD+AE+uW5IzQpFKV74Hf/0gHWF0OkSaeS3zWYV zPUY2WfNbQacf5qTtTMi5FOcagzNjJlAJLDMwxbolrfpi/2Bo81tQgR97t1UBypz5FYA A10U2Wg0cfdZcYmaAmNrrpl9vG5SgWib3MBcA7qwqRlJQmERZsyI7XzUKHjb03r6lbtc tvpvNakTKXJuLsipX+aCu0PUSNr0pUhVIk4aMQ7LuRHdjmNfrYLO0DJYtTLLuem8TnLU 02gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=z2JGSPO0NVhbjd7JgxtJdKY4SQJS8cxpCsIy4GMOcPA=; fh=Iwnp3zs/YFrtIRcpJhz50Mn8z3gKY/8iRxG09Hb3GMk=; b=OGOLVMTg+/IPyhnKYwohhOzUpI8OW8RyDZYyW16iBtnUVSULPiKU4GlRRCK5bQzkQQ lfYAMw74gs1HdOvGsT6SHErrzMXOrUUKkyzoxCfbkXKALuotCtkijAAk9vBbrL46E5qi XMYrbQX3eIrGZhaFiLTYSVNGTX6rmoiG2ZehfOYva+XJkP6cMjR//N8y4TecZv8eJnJx ikb1AYibXqeG2WBNlLNb1WJVcVqT539IBajW/jly15IF2BkzKI/VdwN/ZBH66QsJimhD THh2PNMm/eYE56C4MZaIiI1GTtJ921kLHblEuqsW14j7gdStP1SkEDRqAhVzhCmtZ8kE EYDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id jx6-20020a170903138600b001c5f5153e41si6864327plb.535.2023.11.05.22.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 22:08:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8C61C80AD9BF; Sun, 5 Nov 2023 22:08:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230374AbjKFGIf (ORCPT + 99 others); Mon, 6 Nov 2023 01:08:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbjKFGId (ORCPT ); Mon, 6 Nov 2023 01:08:33 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 45D38B6; Sun, 5 Nov 2023 22:08:30 -0800 (PST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id A1A70602AB5FF; Mon, 6 Nov 2023 14:08:27 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: sergeantsagara@protonmail.com, ping.cheng@wacom.com, jason.gerecke@wacom.com, jikos@kernel.org, benjamin.tissoires@redhat.com Cc: Su Hui , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2] HID: wacom_sys: add error code check in wacom_feature_mapping Date: Mon, 6 Nov 2023 14:08:16 +0800 Message-Id: <20231106060815.104971-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 05 Nov 2023 22:08:43 -0800 (PST) hid_report_raw_event() can return error code like '-ENOMEM' if failed, so check 'ret' to make sure all things work fine. Signed-off-by: Su Hui --- v2: - report the returned error (Rahul Rameshbabu) and __func__. drivers/hid/wacom_sys.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 3f704b8072e8..899579c6db9d 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -320,6 +320,9 @@ static void wacom_feature_mapping(struct hid_device *hdev, if (ret == n && features->type == HID_GENERIC) { ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, data, n, 0); + if (ret) + hid_warn(hdev, "%s: failed to report feature: %pe\n", + __func__, ERR_PTR(ret)); } else if (ret == 2 && features->type != HID_GENERIC) { features->touch_max = data[1]; } else { @@ -381,6 +384,9 @@ static void wacom_feature_mapping(struct hid_device *hdev, if (ret == n) { ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, data, n, 0); + if (ret) + hid_warn(hdev, "%s: failed to report feature: %pe\n", + __func__, ERR_PTR(ret)); } else { hid_warn(hdev, "%s: could not retrieve sensor offsets\n", __func__); -- 2.30.2