Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] HID: wacom_sys: add error code check in wacom_feature_mapping
@ 2023-10-20  9:02 Su Hui
  2023-11-06  3:57 ` Rahul Rameshbabu
  0 siblings, 1 reply; 3+ messages in thread
From: Su Hui @ 2023-10-20  9:02 UTC (permalink / raw)
  To: ping.cheng, jason.gerecke, jikos, benjamin.tissoires
  Cc: Su Hui, linux-input, linux-kernel, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-06  5:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20  9:02 [PATCH] HID: wacom_sys: add error code check in wacom_feature_mapping Su Hui
2023-11-06  3:57 ` Rahul Rameshbabu
2023-11-06  5:50   ` Su Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox