Re: [PATCH v2 9/9] HID: haptic: Remove stubs in favor of inlined dead code elimination

From
sashiko-bot@kernel.org
Date
2026-11-11 00:45:18
Reply to
Rong Zhang, 2026-11-09
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: haptic: hid_haptic_connected_to_input() returns ERR_PTR
  instead of false
--

commit 3914d83f5b9ce7ec32449543dd125ffa8f399224
Author: Rong Zhang [off-list ref]

HID: haptic: Remove stubs in favor of inlined dead code elimination

This commit removes the #else stub implementations in
drivers/hid/hid-haptic.h and replaces them with hid_haptic_enabled()
checks inside the inline helpers.
quoted hunk ↗ jump to hunk
diff --git a/drivers/hid/hid-haptic.h b/drivers/hid/hid-haptic.h
index a71ccee569f31..070b56189ccbe 100644
--- a/drivers/hid/hid-haptic.h
+++ b/drivers/hid/hid-haptic.h
[ ... ]
quoted hunk ↗ jump to hunk
@@ -80,6 +87,9 @@ static inline struct hid_haptic_device *hid_haptic_alloc(struct hid_device *hdev
 static inline bool hid_haptic_connected_to_input(struct hid_haptic_device *haptic,
 						 struct input_dev *input)
 {
+	if (!hid_haptic_enabled())
+		return ERR_PTR(-EOPNOTSUPP);
+
 	return haptic->input_dev == input;
 }
[Severity: Medium]
Should hid_haptic_connected_to_input() return false instead of
ERR_PTR(-EOPNOTSUPP) when !hid_haptic_enabled()?  Because the return type
is bool, the non-NULL error pointer converts to true, inverting the return
value of the removed stub and preventing dead-code elimination in callers
such as mt_touch_input_configured().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-hid-haptic-kmod-v2-0-b835a067cb62@rong.moe?part=9
Thread (14 messages) 14 messages, 2 authors, last reply 3d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help