[PATCH] Input: sur40: prevent polling loop from stalling
From: jj jj <hidden>
Date: 2026-09-13 02:28:56
When the SUR40 driver receives a packet with no blobs while blobs are
still expected, packet_blobs remains zero and need_blobs is never
decremented.
This causes the polling loop to make no progress.
Return from the polling operation when no blobs are received while
blobs are still expected.
Tested in a VM by reproducing the condition and verifying that the
driver no longer remains in the polling loop.
Fixes: bdb5c57f209c ("Input: add sur40 driver for Samsung SUR40 (aka
MS Surface 2.0/Pixelsense)")
Signed-off-by: Fartman42121cool <redacted>
---
drivers/input/touchscreen/sur40.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/input/touchscreen/sur40.cb/drivers/input/touchscreen/sur40.c
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c@@ -510,6 +510,13 @@ static void sur40_poll(struct input_dev *input) if (packet_blobs > need_blobs) packet_blobs = need_blobs; + if (!packet_blobs && need_blobs) { + dev_err(sur40->dev, "received no blobs while %d are still expected\n", + need_blobs); + return; + } + + for (i = 0; i < packet_blobs; i++) { need_blobs--; dev_dbg(sur40->dev, "processing blob\n"); sur40_report_blob(&(inblob[i]), input);