* [PATCH RESEND v2] dma-buf: heaps: use max3 in dma_heap_ioctl
@ 2026-05-17 17:23 Thorsten Blum
2026-05-18 6:01 ` Claude review: " Claude Code Review Bot
2026-05-18 6:01 ` Claude Code Review Bot
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-05-17 17:23 UTC (permalink / raw)
To: Sumit Semwal, Benjamin Gaignard, Brian Starkey, John Stultz,
T.J. Mercier, Christian König
Cc: Thorsten Blum, linux-media, dri-devel, linaro-mm-sig,
linux-kernel
Replace two nested max() calls with a single max3() in dma_heap_ioctl().
Reviewed-by: T.J. Mercier <tjmercier@google.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Changes in v2:
- Include minmax.h as suggested by T.J. Mercier
- v1: https://lore.kernel.org/lkml/20260427172519.417333-3-thorsten.blum@linux.dev/
---
drivers/dma-buf/dma-heap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index ac5f8685a649..d49188893608 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -13,6 +13,7 @@
#include <linux/err.h>
#include <linux/export.h>
#include <linux/list.h>
+#include <linux/minmax.h>
#include <linux/nospec.h>
#include <linux/syscalls.h>
#include <linux/uaccess.h>
@@ -153,7 +154,7 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd,
in_size = 0;
if ((ucmd & kcmd & IOC_OUT) == 0)
out_size = 0;
- ksize = max(max(in_size, out_size), drv_size);
+ ksize = max3(in_size, out_size, drv_size);
/* If necessary, allocate buffer for ioctl argument */
if (ksize > sizeof(stack_kdata)) {
^ permalink raw reply related [flat|nested] 3+ messages in thread* Claude review: dma-buf: heaps: use max3 in dma_heap_ioctl
2026-05-17 17:23 [PATCH RESEND v2] dma-buf: heaps: use max3 in dma_heap_ioctl Thorsten Blum
@ 2026-05-18 6:01 ` Claude Code Review Bot
2026-05-18 6:01 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-05-18 6:01 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Status: Clean**
The patch does two things:
1. Adds `#include <linux/minmax.h>` (line 16 after patch), which provides the `max3` macro. This is correctly placed in alphabetical order among the existing includes.
2. Replaces the nested `max()` calls:
```c
- ksize = max(max(in_size, out_size), drv_size);
+ ksize = max3(in_size, out_size, drv_size);
```
All three variables are declared as `unsigned int` at line 138:
```c
unsigned int in_size, out_size, drv_size, ksize;
```
This makes the `max3` call type-safe with no risk of signed/unsigned comparison issues.
The change is functionally equivalent and slightly more readable. No concerns.
**Reviewed-by: Already has R-b from T.J. Mercier.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Claude review: dma-buf: heaps: use max3 in dma_heap_ioctl
2026-05-17 17:23 [PATCH RESEND v2] dma-buf: heaps: use max3 in dma_heap_ioctl Thorsten Blum
2026-05-18 6:01 ` Claude review: " Claude Code Review Bot
@ 2026-05-18 6:01 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-05-18 6:01 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: dma-buf: heaps: use max3 in dma_heap_ioctl
Author: Thorsten Blum <thorsten.blum@linux.dev>
Patches: 1
Reviewed: 2026-05-18T16:01:29.053378
---
This is a single-patch series that is a straightforward, correct cleanup. It replaces `max(max(in_size, out_size), drv_size)` with `max3(in_size, out_size, drv_size)` and adds the corresponding `#include <linux/minmax.h>` header. The change is purely cosmetic — it improves readability with no functional change. All three arguments are the same type (`unsigned int`), so there are no type-promotion concerns with `max3`.
Already has a Reviewed-by from T.J. Mercier.
**Verdict: Looks good. No issues found.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-18 6:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-17 17:23 [PATCH RESEND v2] dma-buf: heaps: use max3 in dma_heap_ioctl Thorsten Blum
2026-05-18 6:01 ` Claude review: " Claude Code Review Bot
2026-05-18 6:01 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox