Return-Path: Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id ECE6A6E061 for ; Fri, 25 Jun 2021 14:01:25 +0000 (UTC) From: Boris Brezillon Date: Fri, 25 Jun 2021 16:01:10 +0200 Message-Id: <20210625140118.2600731-3-boris.brezillon@collabora.com> In-Reply-To: <20210625140118.2600731-1-boris.brezillon@collabora.com> References: <20210625140118.2600731-1-boris.brezillon@collabora.com> MIME-Version: 1.0 Subject: [igt-dev] [PATCH v3 02/10] lib/panfrost: Handle the NULL case in igt_panfrost_free_bo() List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig , Steven Price , Robin Murphy Cc: igt-dev@lists.freedesktop.org, Petri Latvala , Alyssa Rosenzweig List-ID: So we don't have to bother checking the value before calling this function. v2: * No changes Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- lib/igt_panfrost.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/igt_panfrost.c b/lib/igt_panfrost.c index 8b0c2b7743ea..4bbb5ddf4076 100644 --- a/lib/igt_panfrost.c +++ b/lib/igt_panfrost.c @@ -72,6 +72,9 @@ igt_panfrost_gem_new(int fd, size_t size) void igt_panfrost_free_bo(int fd, struct panfrost_bo *bo) { + if (!bo) + return; + if (bo->map) munmap(bo->map, bo->size); gem_close(fd, bo->handle); -- 2.31.1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev