[PATCH 3/4] HID: picolcd: Use min() macro to simplify code
From: Chen Changcheng
Date: Mon Jul 27 2026 - 23:04:22 EST
Replace open-coded min() logic with the standard min() macro
in hid-picolcd_debugfs.c for limiting read size.
Detected by Coccinelle:
./hid-picolcd_debugfs.c:89:17-18: WARNING opportunity for min()
Signed-off-by: Chen Changcheng <chenchangcheng@xxxxxxxxxx>
---
drivers/hid/hid-picolcd_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-picolcd_debugfs.c b/drivers/hid/hid-picolcd_debugfs.c
index 085847a92e07..c5e0e9076de9 100644
--- a/drivers/hid/hid-picolcd_debugfs.c
+++ b/drivers/hid/hid-picolcd_debugfs.c
@@ -86,7 +86,7 @@ static ssize_t picolcd_debug_eeprom_read(struct file *f, char __user *u,
/* prepare buffer with info about what we want to read (addr & len) */
raw_data[0] = *off & 0xff;
raw_data[1] = (*off >> 8) & 0xff;
- raw_data[2] = s < 20 ? s : 20;
+ raw_data[2] = min(s, 20);
if (*off + raw_data[2] > 0xff)
raw_data[2] = 0x100 - *off;
resp = picolcd_send_and_wait(data->hdev, REPORT_EE_READ, raw_data,
--
2.25.1