* [PATCH] dma-buf: heaps: use max3() in dma_heap_ioctl
@ 2026-04-27 17:25 Thorsten Blum
2026-04-27 17:40 ` T.J. Mercier
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-04-27 17:25 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().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/dma-buf/dma-heap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index ac5f8685a649..52eec2ebb2e8 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -153,7 +153,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] 2+ messages in thread
* Re: [PATCH] dma-buf: heaps: use max3() in dma_heap_ioctl
2026-04-27 17:25 [PATCH] dma-buf: heaps: use max3() in dma_heap_ioctl Thorsten Blum
@ 2026-04-27 17:40 ` T.J. Mercier
0 siblings, 0 replies; 2+ messages in thread
From: T.J. Mercier @ 2026-04-27 17:40 UTC (permalink / raw)
To: Thorsten Blum
Cc: Sumit Semwal, Benjamin Gaignard, Brian Starkey, John Stultz,
Christian König, linux-media, dri-devel, linaro-mm-sig,
linux-kernel
On Mon, Apr 27, 2026 at 10:26 AM Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> Replace two nested max() calls with a single max3() in dma_heap_ioctl().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/dma-buf/dma-heap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
> index ac5f8685a649..52eec2ebb2e8 100644
> --- a/drivers/dma-buf/dma-heap.c
> +++ b/drivers/dma-buf/dma-heap.c
> @@ -153,7 +153,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);
Hi,
Could you add #include <linux/minmax.h> as well? It's currently missing.
With that: Reviewed-by: T.J.Mercier <tjmercier@google.com>
Thanks,
T.J.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-27 17:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 17:25 [PATCH] dma-buf: heaps: use max3() in dma_heap_ioctl Thorsten Blum
2026-04-27 17:40 ` T.J. Mercier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox