Skip to contentSkip to conversation

misc: lis3lv02d: Use min to simplify lis3lv02d_misc_read

PATCH New Thorsten Blum 1 participant 1 message Oct 16, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: lis3lv02d: Use min to simplify lis3lv02d_misc_read

Use min() to simplify lis3lv02d_misc_read().

---
 drivers/misc/lis3lv02d/lis3lv02d.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/misc/lis3lv02d/lis3lv02d.c +2 -4
index 6957091ab6de..1a634ac1a241 100644
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/sched/signal.h>
 #include <linux/dmi.h>
+#include <linux/minmax.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -629,10 +630,7 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
 		schedule();
 	}
 
-	if (data < 255)
-		byte_data = data;
-	else
-		byte_data = 255;
+	byte_data = min(data, 255);
 
 	/* make sure we are not going into copy_to_user() with
 	 * TASK_INTERRUPTIBLE state */
Signature · 1 line
2.50.1