diff mbox series

[v2] HID: wacom_sys: add error code check in wacom_feature_mapping

Message ID 20231106060815.104971-1-suhui@nfschina.com (mailing list archive)
State New
Delegated to: Jiri Kosina
Headers show
Series [v2] HID: wacom_sys: add error code check in wacom_feature_mapping | expand

Commit Message

Su Hui Nov. 6, 2023, 6:08 a.m. UTC
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 <suhui@nfschina.com>
---
v2:
 - report the returned error (Rahul Rameshbabu) and __func__.

 drivers/hid/wacom_sys.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Rahul Rameshbabu Nov. 6, 2023, 6:16 a.m. UTC | #1
On Mon, 06 Nov, 2023 14:08:16 +0800 "Su Hui" <suhui@nfschina.com> wrote:
> 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 <suhui@nfschina.com>
> ---
> v2:
>  - report the returned error (Rahul Rameshbabu) and __func__.

Thanks for the patch. Like the addition of using __func__.

Reviewed-by: Rahul Rameshbabu <sergeantsagara@protonmail.com>
diff mbox series

Patch

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__);