All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: "Tejas Upadhyay" <tejaskumarx.surendrakumar.upadhyay@intel.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: [Intel-gfx] [topic/core-for-CI] dma-buf: Check for empty dma_fence_array
Date: Mon, 28 Mar 2022 15:51:44 +0530	[thread overview]
Message-ID: <20220328102144.1374607-1-tejaskumarx.surendrakumar.upadhyay@intel.com> (raw)

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
---
 drivers/dma-buf/dma-fence-array.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
index 52b85d292383..5c8a7084577b 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -159,6 +159,8 @@ struct dma_fence_array *dma_fence_array_create(int num_fences,
 	struct dma_fence_array *array;
 	size_t size = sizeof(*array);
 
+	WARN_ON(!num_fences || !fences);
+
 	/* Allocate the callback structures behind the array. */
 	size += num_fences * sizeof(struct dma_fence_array_cb);
 	array = kzalloc(size, GFP_KERNEL);
@@ -231,6 +233,9 @@ struct dma_fence *dma_fence_array_first(struct dma_fence *head)
 	if (!array)
 		return head;
 
+	if (!array->num_fences)
+		return NULL;
+
 	return array->fences[0];
 }
 EXPORT_SYMBOL(dma_fence_array_first);
-- 
2.34.1


             reply	other threads:[~2022-03-28 10:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 10:21 Tejas Upadhyay [this message]
2022-03-28 16:39 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for dma-buf: Check for empty dma_fence_array Patchwork
2022-03-28 16:44 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-03-28 17:15 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-03-29  0:03 [Intel-gfx] [topic/core-for-CI] " kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220328102144.1374607-1-tejaskumarx.surendrakumar.upadhyay@intel.com \
    --to=tejaskumarx.surendrakumar.upadhyay@intel.com \
    --cc=christian.koenig@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.