From nobody Fri Mar 27 01:33:53 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 A2F2C37A4B5 for ; Mon, 23 Feb 2026 22:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771884094; cv=none; b=lvrRtiz6b/Jl7H1j8NvuSMREUKSKkPb4gHsmTr1bSAwHXD3k3I6bJghZ18bjlv2WKHehm1N7LmPlsjLqZpNYCOeL2lzIqWUmHfYljIBWEtRMyg/SP1JTqhnJtH9i/+gKaz36loZ2eh9E0gnRmGJZht0pFYpnmxxEMhMgFAbB9AA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771884094; c=relaxed/simple; bh=O7msDbSV/q/aPMQwbkM5TLFQRq+8/vrOQCED1+8NCdY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OSJK/xvA/7OMTzosIsC3HBllDnWmNp7MZK6UPC45ObldDJuoRHsDk8s4iTrN+bJF3tfgrfhWTS4USS9/3eNuH8YrJy+fwPQa4Rmm/Jta1/qRucBFJQMhd9dcq8KJ4ZxLBIMh3ofUA3SU6HieiFbgQOXLvsEyqIy1jNU8kNGCHTI= 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=T50wnAdF; arc=none smtp.client-ip=91.218.175.171 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="T50wnAdF" 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=1771884090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cx0m4RKg1tjcI09gpNOMxEOQE0GYux9DXoEt7ZAs+co=; b=T50wnAdF5NS6LJODD63u0Q0iXUFJUCfVWKAWRCHWBZDCJUzfkQpYYXWD6CNLxdSxw68e1g Fg1GaeLRWLQvc9K2x85NBZjp2dyIVlEHz00oPEOawOboR2WazxMfd7EbTMCxrkv0igrxE2 Ps810Q5/SoC8nXHjHClv4R6ZP4gKSEY= From: Bart Van Assche To: Peter Zijlstra Cc: Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , linux-kernel@vger.kernel.org, Marco Elver , Christoph Hellwig , Steven Rostedt , Nick Desaulniers , Nathan Chancellor , Kees Cook , Jann Horn , Bart Van Assche , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , linux-media@vger.kernel.org Subject: [PATCH 05/62] dma-buf: Convert dma_buf_import_sync_file() to the early-return style Date: Mon, 23 Feb 2026 14:00:05 -0800 Message-ID: <20260223220102.2158611-6-bart.vanassche@linux.dev> In-Reply-To: <20260223220102.2158611-1-bart.vanassche@linux.dev> References: <20260223220102.2158611-1-bart.vanassche@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT From: Bart Van Assche Before making changes in dma_buf_import_sync_file(), convert it to the early-return coding style. No functionality has been changed. Cc: Sumit Semwal Cc: Christian K=C3=B6nig Cc: linux-media@vger.kernel.org Signed-off-by: Bart Van Assche --- drivers/dma-buf/dma-buf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 11711874a325..1666133ac8b8 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -523,11 +523,13 @@ static long dma_buf_import_sync_file(struct dma_buf *= dmabuf, dma_resv_lock(dmabuf->resv, NULL); =20 ret =3D dma_resv_reserve_fences(dmabuf->resv, num_fences); - if (!ret) { - dma_fence_unwrap_for_each(f, &iter, fence) - dma_resv_add_fence(dmabuf->resv, f, usage); - } + if (ret) + goto unlock; + + dma_fence_unwrap_for_each(f, &iter, fence) + dma_resv_add_fence(dmabuf->resv, f, usage); =20 +unlock: dma_resv_unlock(dmabuf->resv); } =20