diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-10-16 13:42:33 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-22 07:59:57 +0200 |
| commit | b94eb28cb3ed624f7c335b8f4438b5ba36ea4885 (patch) | |
| tree | 3a59109a55e6a2638eaee9dca1902993183d7e75 | |
| parent | b91c13534a63e8b54fd47ae2de53941e8620ce75 (diff) | |
| download | lwn-b94eb28cb3ed624f7c335b8f4438b5ba36ea4885.tar.gz lwn-b94eb28cb3ed624f7c335b8f4438b5ba36ea4885.zip | |
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>
| -rw-r--r-- | drivers/misc/lis3lv02d/lis3lv02d.c | 6 |
1 files 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 */ |
