drivers/dma-buf/dma-heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
From: FengWei <feng.wei8@zte.com.cn>
Use max3() macro instead of nesting max() to simplify the return
statement.
Signed-off-by: FengWei <feng.wei8@zte.com.cn>
---
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 3cbe87d4a464..96cb9ab5731a 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -147,7 +147,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)) {
--
2.25.1
Am 15.03.25 um 05:40 schrieb feng.wei8@zte.com.cn:
> From: FengWei <feng.wei8@zte.com.cn>
>
> Use max3() macro instead of nesting max() to simplify the return
> statement.
Please add a "dma-buf: heaps: " prefix to the subject line, apart from that looks good to me.
Regards,
Christian.
>
> Signed-off-by: FengWei <feng.wei8@zte.com.cn>
> ---
> 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 3cbe87d4a464..96cb9ab5731a 100644
> --- a/drivers/dma-buf/dma-heap.c
> +++ b/drivers/dma-buf/dma-heap.c
> @@ -147,7 +147,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)) {
© 2016 - 2025 Red Hat, Inc.