From patchwork Fri Oct 20 09:02:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Hui X-Patchwork-Id: 13430312 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10BF2CDB474 for ; Fri, 20 Oct 2023 09:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376554AbjJTJDM (ORCPT ); Fri, 20 Oct 2023 05:03:12 -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 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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__);