From nobody Mon May 25 06:40:20 2026 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (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 5328325FA10 for ; Sun, 17 May 2026 17:24:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779038658; cv=none; b=UZkCCojn6G+L22aEzEWEof9gwE/FJw/Tx2p27t9RFP2mNZChujw6gMcCPZ1M0qoOVsnq2AM/K/FOnRYN/3e6QM1aQUEExBn/uFwUkT/Ch045Kv+qFavuwqsRN520jnXciMKpMOqxejRUbjIjKcZE0z4PnplbdOgEc3ZwFr2iGJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779038658; c=relaxed/simple; bh=2Qy1bhZE4ZUxVczuVFGuB6tJXixNg2z/25mUfsiG6bg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jB2d8wcU8RsQqrVFkGrtH9suvCaiepkmHkv5LmuzhcBnFrtiTqeXs4pE+kmSTjuA3HfJdVOFn/zEZYuFb6tlDAjKIOfJ7JbMmAgtRbshIF6dDAj/v6qpDH/rKkjQ+t3woTSslu/7rTyfzsDUrk0JM4VZdrTCGjWB71401C6WXCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=C0Jkif0W; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="C0Jkif0W" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779038645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=hueLhtL3zsdmdXnMtuPrauJ8fkjBDESO/03aEH4/H2E=; b=C0Jkif0WiffvNY1BfsznBsr9/Y/cagb1baZyUmCRRG+gY5j7nDRJdQ7djJktZoFUtCItnD kCRU3w5AxOEEqgzpcZOpFnKDCpkic3dHBIl9LiImC/iipMlJY/sPVxy2us+CHCeckgtdYV hZj8+rL8KwTOEqEPDfXoJXWIu5GgUe8= From: Thorsten Blum To: Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: Thorsten Blum , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND v2] dma-buf: heaps: use max3 in dma_heap_ioctl Date: Sun, 17 May 2026 19:23:53 +0200 Message-ID: <20260517172352.3615-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1175; i=thorsten.blum@linux.dev; h=from:subject; bh=2Qy1bhZE4ZUxVczuVFGuB6tJXixNg2z/25mUfsiG6bg=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFmcP1f4TOnRZosXO71QYZ/h1sf+CvOZt2/JPL1xhs+GC 7uC8p0fd5SyMIhxMciKKbI8mPVjhm9pTeUmk4idMHNYmUCGMHBxCsBEMl8w/E9NZXQWOpjX9cFP f9vU6zOv1X+PfHhp+uVIM635Py32vT3CyPDq+bI7L7+o7Dk7r8LjhUit7tp7R1sErpt88eeW0la YXcsFAA== X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Replace two nested max() calls with a single max3() in dma_heap_ioctl(). Reviewed-by: T.J. Mercier Signed-off-by: Thorsten Blum --- Changes in v2: - Include minmax.h as suggested by T.J. Mercier - v1: https://lore.kernel.org/lkml/20260427172519.417333-3-thorsten.blum@li= nux.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 #include #include +#include #include #include #include @@ -153,7 +154,7 @@ static long dma_heap_ioctl(struct file *file, unsigned = int ucmd, in_size =3D 0; if ((ucmd & kcmd & IOC_OUT) =3D=3D 0) out_size =3D 0; - ksize =3D max(max(in_size, out_size), drv_size); + ksize =3D max3(in_size, out_size, drv_size); =20 /* If necessary, allocate buffer for ioctl argument */ if (ksize > sizeof(stack_kdata)) {