misc: lis3lv02d: Use min to simplify lis3lv02d_misc_read

Use min() to simplify lis3lv02d_misc_read().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20251016114234.72221-1-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pull/1354/merge
Thorsten Blum 2025-10-16 13:42:33 +02:00 committed by Greg Kroah-Hartman
parent b91c13534a
commit b94eb28cb3
1 changed files with 2 additions and 4 deletions

View File

@ -12,6 +12,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched/signal.h> #include <linux/sched/signal.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/minmax.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
@ -629,10 +630,7 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
schedule(); schedule();
} }
if (data < 255) byte_data = min(data, 255);
byte_data = data;
else
byte_data = 255;
/* make sure we are not going into copy_to_user() with /* make sure we are not going into copy_to_user() with
* TASK_INTERRUPTIBLE state */ * TASK_INTERRUPTIBLE state */