Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp881385rdb; Fri, 20 Oct 2023 02:03:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7nt1wDjT28LZN3q3MlgatBDQ1ujBExYCJ3nFi4wfp4+DhA2s7fGMZgeY0VydWwoDV+E5x X-Received: by 2002:a25:9785:0:b0:d9a:d78f:9fe6 with SMTP id i5-20020a259785000000b00d9ad78f9fe6mr1248145ybo.41.1697792609094; Fri, 20 Oct 2023 02:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697792609; cv=none; d=google.com; s=arc-20160816; b=eF6hjg/IC9QCQsBalaZWj6QJ80QqLPrlMjTsCzWfGJUPavqJzL5PYY/ZRHfuXdwws/ 8cCCwSW/ZkcrJluDC87QQzu0AyzJ0QrVjZJI23oqiIIWMx5THonJO2wMuNmdv+CNajza zMBftw9AQ25kCPxNEg7nvWbBEynsk0uuRTnUuFI//xJ26wgGMmDO85oEfIv02HTj31hJ h0dQ+86e5G6vD7np33bBZQnhbT0PXo9d8Z3dSjfV+2DGICPxGgT0kUe1rtZENNawKcRG dPQ4VxGB6YE8me6HyRITRrlojLpWrppmbGfIDvdy1rFcmj2baBrMUSS9c8FCrrSPeYUR +9xA== 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=wBzBUXCTd/wDFAW8YBoecWm78OE0NcxPGxQpfig9dlw=; fh=E9sYvlP+TBJD7N0328pTkSurr+8vBd1ZTmxlWFB9Q64=; b=g2ddKin3DRAl6CWs14ZrgXBL0sv/Tctjc+famDPE8P4X/gBMOmPDVjmjVEQtMBV0dI jfVnHQs78uRAzWTWLfvF2qK5URRW6jO7mXakIomxOUT2KyoFJJ0uY/63rw+j0MP4IcuA 15xzNfHbKaUjRWL0EsLVw0u+0cUZGfN3b1BOiv02ejPpzGgbNtmmwvkdJ5cgS25ZapzE B12Ug57T35bIG98vzO4iHajdhhmVJcUnN+PIdneKCmBQOgvxkjgVbKmboSweEKDxEFWY yUlNYzzGec3ob6LRiugRyHq6ejLIvRxpXzjkmaqnsqGTjQXpTK1BE9Z2PPj+j4Tnvum5 MLzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id a19-20020a656413000000b005b18ac47c0fsi1436729pgv.532.2023.10.20.02.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 02:03:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 822228339642; Fri, 20 Oct 2023 02:03:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376571AbjJTJDN (ORCPT + 99 others); Fri, 20 Oct 2023 05:03:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376523AbjJTJDL (ORCPT ); Fri, 20 Oct 2023 05:03:11 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id B937AD67; Fri, 20 Oct 2023 02:03:06 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 776BE60494CD8; Fri, 20 Oct 2023 17:03:03 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: 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] HID: wacom_sys: add error code check in wacom_feature_mapping Date: Fri, 20 Oct 2023 17:02:38 +0800 Message-Id: <20231020090237.201029-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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Fri, 20 Oct 2023 02:03:24 -0700 (PDT) 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 --- drivers/hid/wacom_sys.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 3f704b8072e8..1f898d4ee708 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -320,6 +320,8 @@ 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, "failed to report feature\n"); } else if (ret == 2 && features->type != HID_GENERIC) { features->touch_max = data[1]; } else { @@ -381,6 +383,8 @@ 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, "failed to report feature\n"); } else { hid_warn(hdev, "%s: could not retrieve sensor offsets\n", __func__); -- 2.30.2