[PATCH 09/10] Input: synaptics-rmi4 - change report_size to size_t in F54

From: Dmitry Torokhov

Date: Fri Jun 26 2026 - 01:20:44 EST


Change report_size from int to size_t in struct f54_data and update all
its usages. This avoids signed/unsigned comparison warnings when
comparing with size_t variables and matches the signature of
rmi_read_block() which takes size_t for length.

Also move the declaration of the loop variable 'i' into the 'for' loop
header.

Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/input/rmi4/rmi_f54.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
index 850e1742c480..5d045ece3c2f 100644
--- a/drivers/input/rmi4/rmi_f54.c
+++ b/drivers/input/rmi4/rmi_f54.c
@@ -105,7 +105,7 @@ struct f54_data {
enum rmi_f54_report_type report_type;
u8 *report_data;
size_t max_report_size;
- int report_size;
+ size_t report_size;
int report_error;

bool is_busy;
@@ -355,7 +355,7 @@ static void rmi_f54_buffer_queue(struct vb2_buffer *vb)
}

if (f54->report_size > vb2_plane_size(vb, 0)) {
- dev_err(&f54->fn->dev, "Buffer too small (%lu < %d)\n",
+ dev_err(&f54->fn->dev, "Buffer too small (%lu < %zu)\n",
vb2_plane_size(vb, 0), f54->report_size);
state = VB2_BUF_STATE_ERROR;
goto data_done;
@@ -553,10 +553,9 @@ static void rmi_f54_work(struct work_struct *work)
struct f54_data *f54 = container_of(work, struct f54_data, work.work);
struct rmi_function *fn = f54->fn;
u8 fifo[2];
- int report_size;
+ size_t report_size;
u8 command;
int error;
- int i;

mutex_lock(&f54->data_mutex);

@@ -569,7 +568,7 @@ static void rmi_f54_work(struct work_struct *work)
}

if (report_size > f54->max_report_size) {
- dev_err(&fn->dev, "Report size %d exceeds buffer size %zu\n",
+ dev_err(&fn->dev, "Report size %zu exceeds buffer size %zu\n",
report_size, f54->max_report_size);
error = -EINVAL;
goto out;
@@ -596,8 +595,8 @@ static void rmi_f54_work(struct work_struct *work)

rmi_dbg(RMI_DEBUG_FN, &fn->dev, "Get report command completed, reading data\n");

- for (i = 0; i < report_size; i += F54_REPORT_DATA_SIZE) {
- int size = min(F54_REPORT_DATA_SIZE, report_size - i);
+ for (size_t i = 0; i < report_size; i += F54_REPORT_DATA_SIZE) {
+ size_t size = min_t(size_t, F54_REPORT_DATA_SIZE, report_size - i);

fifo[0] = i & 0xff;
fifo[1] = i >> 8;
@@ -613,7 +612,7 @@ static void rmi_f54_work(struct work_struct *work)
F54_REPORT_DATA_OFFSET,
f54->report_data + i, size);
if (error) {
- dev_err(&fn->dev, "%s: read [%d bytes] returned %d\n",
+ dev_err(&fn->dev, "%s: read [%zu bytes] returned %d\n",
__func__, size, error);
goto out;
}
--
2.55.0.rc0.799.gd6f94ed593-goog