Skip to content

Commit aa528cd

Browse files
tobluxaxboe
authored andcommitted
block/partitions/acorn: use min in {riscix,linux}_partition
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>
1 parent 6636e16 commit aa528cd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

block/partitions/acorn.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
#include <linux/buffer_head.h>
1111
#include <linux/adfs_fs.h>
12+
#include <linux/minmax.h>
1213

1314
#include "check.h"
1415

@@ -80,7 +81,7 @@ static int riscix_partition(struct parsed_partitions *state,
8081

8182

8283
if (rr->magic == RISCIX_MAGIC) {
83-
unsigned long size = nr_sects > 2 ? 2 : nr_sects;
84+
unsigned long size = min(nr_sects, 2);
8485
int part;
8586

8687
seq_buf_puts(&state->pp_buf, " <");
@@ -124,7 +125,7 @@ static int linux_partition(struct parsed_partitions *state,
124125
{
125126
Sector sect;
126127
struct linux_part *linuxp;
127-
unsigned long size = nr_sects > 2 ? 2 : nr_sects;
128+
unsigned long size = min(nr_sects, 2);
128129

129130
seq_buf_puts(&state->pp_buf, " [Linux]");
130131

0 commit comments

Comments
 (0)