[PATCH v7 2/2] HID: intel-thc-hid: quickspi, quicki2c: skip an empty read

From: Emfox Zhou

Date: Tue Nov 17 2026 - 05:54:53 EST


A drain ends when the ring holds no frame, and thc_rxdma_read() reports
that as a successful read of zero bytes. Both handlers go by the buffer
instead of the length: quickspi hands the zero on and its own length check
then rejects the frame still left in the buffer, while quicki2c reads
pkt->len from the previous frame and sends that report again.

Tell the two cases apart by the length. A frame with an empty payload is
still a frame, and quicki2c needs that one for its reset ack.

Fixes: 4138f21115ae ("HID: intel-thc-hid: intel-quickspi: Complete THC QuickSPI driver")
Fixes: 66b59bfce6d9 ("HID: intel-thc-hid: intel-quicki2c: Complete THC QuickI2C driver")
Signed-off-by: Emfox Zhou <emfox@xxxxxxxxxx>
---
drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 3 +++
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c | 3 +++
2 files changed, 6 insertions(+)

diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
index 29319b622..8e3f7f3f6 100644
--- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
+++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
@@ -298,6 +298,9 @@ static int handle_input_report(struct quicki2c_device *qcdev)
if (ret)
return ret;

+ if (!report_len)
+ continue;
+
if (!pkt->len) {
if (qcdev->state == QUICKI2C_RESETING) {
qcdev->reset_ack = true;
diff --git a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
index bf49d8ce5..812f743f6 100644
--- a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
+++ b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
@@ -331,6 +331,9 @@ static irqreturn_t quickspi_irq_thread_handler(int irq, void *dev_id)
goto end;
}

+ if (!input_len)
+ continue;
+
quickspi_handle_input_data(qsdev, input_len);
}
}