From patchwork Mon Nov 6 06:08:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Hui X-Patchwork-Id: 13446252 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 85301C4332F for ; Mon, 6 Nov 2023 06:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjKFGIe (ORCPT ); Mon, 6 Nov 2023 01:08:34 -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 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 Reviewed-by: Rahul Rameshbabu --- 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__);