Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1892923rdf; Sun, 5 Nov 2023 19:58:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGivY4qqCjCbgvq0Tp6RUTBBs1FPvRvCn0GF1/s0djQVkdMN6dnk6Po7vzFMo1SeZxlo2AZ X-Received: by 2002:a05:6a00:1589:b0:6b3:81ee:9bc with SMTP id u9-20020a056a00158900b006b381ee09bcmr27236374pfk.27.1699243083414; Sun, 05 Nov 2023 19:58:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699243083; cv=none; d=google.com; s=arc-20160816; b=U8Bvm8iS8CVAYNDpq5dZPY9t3Onu8ngCFQlU2NqX5DIiyIYQeABoOK00LueepiKRXT rU2Zmy0vLXRk+YX0c1R7RWgsO+PiLXEQKhSjGomkeXod5OsyqtP83Kq/1nf9nOjdqKbT jlMDo1QxRep8TEAeG2rCjYhxd/KLKPLMaNbRjN8i4wc4uzqSTT88SeSdDEEXUYBMhaKM MpqO2k03o5ZyQnxtJNjp64fDdMho9jrRhPkFO9Fs2wLXra+RcWzr5XNIRxKBqUmZPnCm RSzlmWsE54xLu/PwXwDTlKH1eOJfUiLg+M/zs5aTVAKEFBeOLR+zp9tGWsimCm9I89iY 5wvA== 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 :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :date:dkim-signature; bh=As3a27QMW/BoHW+UlSXOW4dmynjX02XHuetDPzr1fAg=; fh=U8U8DhF7/A+1vVtl0JkPS6xMd2rGMx1r7xF+KOGaMUM=; b=WdMYlNWRYC4y+6dGb2ATOfhnkVRWRQKaogLbA7h1J7QgWTB/A4k+mlQVV5M3ei+aW6 FB5JxTpwtKPCLi2OY6t2/QKOOJiAv+B1Trjy6NZTh/eTF1OuTVFB97mJr4qkqgLFwM61 2MR/8xVcmYDn7oGT4kO+HlzvSj+ayCN1q6gmiMmb9Zd7taRyCnIhv9dtMV4ZXH5353A2 b5BjFxZc7OKiEnFAtc5aFU+hIRYgjjF4X3SOGGjOyZW0sCF1+dSeqlcp87OfMzG07Pwi OAMet0dNX1bneEZutEH6uU9We53LNctXk6S5hYnIzpY0s9LZ3ZeVZE33ImYtJxorceMZ r1ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=BlhvldTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k5-20020a056a00134500b006bec15892c9si7596663pfu.141.2023.11.05.19.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 19:58:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=BlhvldTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id F41F0805EB07; Sun, 5 Nov 2023 19:58:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229485AbjKFD5w (ORCPT + 99 others); Sun, 5 Nov 2023 22:57:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbjKFD5v (ORCPT ); Sun, 5 Nov 2023 22:57:51 -0500 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13EDEF2 for ; Sun, 5 Nov 2023 19:57:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1699243066; x=1699502266; bh=As3a27QMW/BoHW+UlSXOW4dmynjX02XHuetDPzr1fAg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=BlhvldTx+ZtolLJefmPmmfXaOWSIoBHIGgVD+Ozt4PdRogycXX5xb/xAjyTNQJkoN 1gG1i0KW01EJD/WZ929bmEkGbwsexNCyMqEXdYZC/127RtzPlTSRal2Aypr3Nuv7k+ QRpizadcihXeVXMqOcRy0VdIa3J+E3oCGMgHkzNBk/lQi1OxE9X6RsgYUjOHpHEmdV 8MiR0g/1UXnAG2bQjilDkbwTYXEEkp351zsCtQXUUHRY2QuWLVPN/6RZyay0KvoDP8 K2eOMom3LhYidTXM0riGHoot+2itGyI6MxGDnvd5NoRU15MRhhar2jMW5aWQBznbIB 6J7BGZ3Rr9bxQ== Date: Mon, 06 Nov 2023 03:57:39 +0000 To: Su Hui From: 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 Subject: Re: [PATCH] HID: wacom_sys: add error code check in wacom_feature_mapping Message-ID: <871qd31qkx.fsf@protonmail.com> In-Reply-To: <20231020090237.201029-1-suhui@nfschina.com> References: <20231020090237.201029-1-suhui@nfschina.com> Feedback-ID: 26003777:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 groat.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 (groat.vger.email [0.0.0.0]); Sun, 05 Nov 2023 19:58:01 -0800 (PST) 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, > =09=09=09if (ret =3D=3D n && features->type =3D=3D HID_GENERIC) { > =09=09=09=09ret =3D hid_report_raw_event(hdev, > =09=09=09=09=09HID_FEATURE_REPORT, data, n, 0); > +=09=09=09=09if (ret) > +=09=09=09=09=09hid_warn(hdev, "failed to report feature\n"); I think we should report the returned error information as well. 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. > =09=09=09} else if (ret =3D=3D 2 && features->type !=3D HID_GENERIC) { > =09=09=09=09features->touch_max =3D data[1]; > =09=09=09} else { > @@ -381,6 +383,8 @@ static void wacom_feature_mapping(struct hid_device *= hdev, > =09=09if (ret =3D=3D n) { > =09=09=09ret =3D hid_report_raw_event(hdev, HID_FEATURE_REPORT, > =09=09=09=09=09=09 data, n, 0); > +=09=09=09if (ret) > +=09=09=09=09hid_warn(hdev, "failed to report feature\n"); > =09=09} else { > =09=09=09hid_warn(hdev, "%s: could not retrieve sensor offsets\n", > =09=09=09=09 __func__); -- Thanks for the patch, Rahul Rameshbabu