From patchwork Mon Mar 17 02:21:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: feng.wei8@zte.com.cn X-Patchwork-Id: 14018589 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 986B741C71; Mon, 17 Mar 2025 02:21:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=63.216.63.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742178098; cv=none; b=VLPG8HrhpMrFEhcOTCohieiCL+ncjvS/bH5ospCECGDt9pZd4szcUCAPIfnR9Z6LZfq8bDUofMn9ijC6+9yExPyqecgonFva0ZKgAMWlaJQRQMiNV5RQcLiY9tkZefIaaExJOgzwaT2EkMf/BrdZVx8l9mbMgsUi0TbrsNjzsJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742178098; c=relaxed/simple; bh=84h1O8DcSONgrEc/QxED8/rrm3K/RmQEr9m0awU9UjQ=; h=Date:Message-ID:Mime-Version:From:To:Cc:Subject:Content-Type; b=jtjvcIIwqWer9AacaWY6YB7ZyA26jpjj2P2XnoQtiDA4+HGe0lP3aaWGugUrW1lEw9XQptbn7ilAxCNfV+g+izzibi1E/f0SFUUcMkciahbMtNP4sSs9/LFmQ3cZLQKxfzEJ+YRzH85Ett/1M5SDhRe+v8bqVPTmLi4W7v3P528= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.client-ip=63.216.63.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4ZGJct3tDhz5B1H4; Mon, 17 Mar 2025 10:21:34 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.99.176]) by mse-fl1.zte.com.cn with SMTP id 52H2LKJV021874; Mon, 17 Mar 2025 10:21:21 +0800 (+08) (envelope-from feng.wei8@zte.com.cn) Received: from mapi (xaxapp04[null]) by mapi (Zmail) with MAPI id mid32; Mon, 17 Mar 2025 10:21:22 +0800 (CST) Date: Mon, 17 Mar 2025 10:21:22 +0800 (CST) X-Zmail-TransId: 2afb67d78722ffffffff87f-23ebf X-Mailer: Zmail v1.0 Message-ID: <202503171021222703hl0ry06tOCRmPFcWNp5U@zte.com.cn> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: To: Cc: , , , , , , , , Subject: =?utf-8?q?=5BPATCH_v3=5D_dma-buf=3A_heaps=3A_Replace_nested_max=28?= =?utf-8?q?=29_with_single_max3=28=29?= X-MAIL: mse-fl1.zte.com.cn 52H2LKJV021874 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 67D7872E.000/4ZGJct3tDhz5B1H4 From: FengWei Use max3() macro instead of nesting max() to simplify the return statement. Signed-off-by: FengWei --- v2 -> v3 fix the format of this patch 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)) {