]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block/partitions/acorn: use min in {riscix,linux}_partition
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 2 Jun 2026 16:07:57 +0000 (18:07 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Jun 2026 17:14:52 +0000 (11:14 -0600)
Use min() to replace the open-coded implementations and to simplify
riscix_partition() and linux_partition().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260602160757.973736-3-thorsten.blum@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/partitions/acorn.c

index 9f7389f174d0e6d877cf67f2152418257238f2ee..067d6a27a3bdf3b7748e843bbec604eb73852290 100644 (file)
@@ -9,6 +9,7 @@
  */
 #include <linux/buffer_head.h>
 #include <linux/adfs_fs.h>
+#include <linux/minmax.h>
 
 #include "check.h"
 
@@ -80,7 +81,7 @@ static int riscix_partition(struct parsed_partitions *state,
 
 
        if (rr->magic == RISCIX_MAGIC) {
-               unsigned long size = nr_sects > 2 ? 2 : nr_sects;
+               unsigned long size = min(nr_sects, 2);
                int part;
 
                seq_buf_puts(&state->pp_buf, " <");
@@ -124,7 +125,7 @@ static int linux_partition(struct parsed_partitions *state,
 {
        Sector sect;
        struct linux_part *linuxp;
-       unsigned long size = nr_sects > 2 ? 2 : nr_sects;
+       unsigned long size = min(nr_sects, 2);
 
        seq_buf_puts(&state->pp_buf, " [Linux]");