Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1926217rdf; Sun, 5 Nov 2023 21:51:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3zlJfJ0PLUbtMDsi24xl1WDpcKXYJy3misIo1NWbJPw5MdCxNp5YY+jyVb+j/YZmBMh6T X-Received: by 2002:a05:6870:1303:b0:1f0:84cb:9a35 with SMTP id 3-20020a056870130300b001f084cb9a35mr3799711oab.4.1699249862911; Sun, 05 Nov 2023 21:51:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699249862; cv=none; d=google.com; s=arc-20160816; b=at0VXW2Cb0VT1RiuY9wV9T9QtGzkQxtVeGFr3BVP4NxwqswspyVMoaZRA4E0AZIA8n G6l9L4JNANZae1Oy9FbFrL5nuR5IQ3QuxYkIPK+gnaVwts4CQQaNwpv7MaaRx7Cuf2eX qvKiUmiA3ch/RKO0+LzLG+Nh8cV8m4bzrSAZllAKaRbAVyngVeCFwHaZjGeo0+J9G6lJ iLobAO+62GqZB3/8ktnJvGCKGqrICDAcGRk9aH2Dr2gqxobfTprztbHdzrSUcKxLyN6A OHPR0Qfakmv9BiRIIJVbqQDyANJe/9wjDbEaAjWrp4bcFSA+RiSz7cp3erDK9t/jLKzb TLow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc:to :content-language:subject:user-agent:mime-version:date:message-id; bh=cVqRQpXq+OZXMSRIIha1P+go3aK4HO/SRlEzzTyQnC0=; fh=caegCLqcjZ/2kC4jfecFfL26sqFLjgJhCdVYKq/JH58=; b=jnGFsdolbI8FkCTmhJP9aPwOgaYUUf3OGU84oCjlM7hjvPMxGOhAVu2MVJMrIQeifP cA+R+87pvwHXtEjsd3hyC68FhQjfU24X9wMj9rBwlY8g67BsKqV8DTNdSJFLcSwnKR01 /ug5JrPruPhmWVUESt8F+CNB7+r2cgy46Np0EAEmoLdA5s9rCJYOW+5XOWOXTzuc6vlN K1jdwo56QPnUFDT1w9ZKXpwEx/gtdKqJkjlRoAOOCYVdptbLRgw0pfR1g+AYwTyb+Um+ d6OInRZ3FE/qkvAZzw7XZ/PHBi9IifutgSamJKXOW6MS9e/RyYpq1JQ6fEhHFnhuUBbv 8teA== 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:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id cm13-20020a056a020a0d00b005859b2d8d7asi7894237pgb.4.2023.11.05.21.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 21:51:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 02F5680A18D1; Sun, 5 Nov 2023 21:51:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbjKFFur (ORCPT + 99 others); Mon, 6 Nov 2023 00:50:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbjKFFuq (ORCPT ); Mon, 6 Nov 2023 00:50:46 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 89CBAFA; Sun, 5 Nov 2023 21:50:42 -0800 (PST) Received: from [172.30.11.106] (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id E3FB8602A9F16; Mon, 6 Nov 2023 13:50:09 +0800 (CST) Message-ID: <26575f23-2ccb-98b8-df85-af829460ffd1@nfschina.com> Date: Mon, 6 Nov 2023 13:50:09 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH] HID: wacom_sys: add error code check in wacom_feature_mapping Content-Language: en-US To: Rahul Rameshbabu Cc: ping.cheng@wacom.com, jason.gerecke@wacom.com, jikos@kernel.org, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui In-Reply-To: <871qd31qkx.fsf@protonmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 fry.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 (fry.vger.email [0.0.0.0]); Sun, 05 Nov 2023 21:51:00 -0800 (PST) On 2023/11/6 11:57, Rahul Rameshbabu wrote: > On Fri, 20 Oct, 2023 17:02:38 +0800 "Su Hui" wrote: >> hid_report_raw_event() can return error code like '-ENOMEM' if >> failed, so check 'ret' to make sure all things work fine. > I can agree with adding logging for error cases personally. > >> 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"); > I think we should report the returned error information as well. Agreed, I will send v2 soon. Thanks for your suggestions! Su Hui > > https://docs.kernel.org/core-api/printk-formats.html#error-pointers > > Typically what I do is use ERR_PTR in tandem with the %pe modifier for > printing errors. > >> } 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__); > -- > Thanks for the patch, > > Rahul Rameshbabu >