* [PATCH] misc: lis3lv02d: Use min to simplify lis3lv02d_misc_read
@ 2025-10-16 11:42 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2025-10-16 11:42 UTC (permalink / raw)
To: Eric Piel, Arnd Bergmann, Greg Kroah-Hartman; +Cc: Thorsten Blum, linux-kernel
Use min() to simplify lis3lv02d_misc_read().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/misc/lis3lv02d/lis3lv02d.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index 6957091ab6de..1a634ac1a241 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -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 */
--
2.50.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-16 11:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 11:42 [PATCH] misc: lis3lv02d: Use min to simplify lis3lv02d_misc_read Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox