All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	Colin King <colin.king@canonical.com>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Liam Mark <lmark@codeaurora.org>,
	Laura Abbott <labbott@redhat.com>,
	Brian Starkey <brian.starkey@arm.com>,
	"Andrew F . Davis" <afd@ti.com>,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH] dma-buf: heaps: Fix redundant assignment to variable ret in system_heap.c
Date: Wed, 30 Oct 2019 16:30:40 +0000	[thread overview]
Message-ID: <20191030163040.70055-1-john.stultz@linaro.org> (raw)

Colin King reported a coverity error:
 The variable ret is being assigned with a value that is never
 read, it is being re-assigned the same value on the err0 exit
 path. The assignment is redundant and hence can be removed.

He had a fix, but Andrew Davis suggested a better solution
(actually returning ret), so this patch implements that fix.

Cc: Colin King <colin.king@canonical.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: kernel-janitors@vger.kernel.org
Addresses-Coverity: ("Unused value")
Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
Reported-by: Colin Ian King <colin.king@canonical.com>
Suggested-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/dma-buf/heaps/system_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
index 455782efbb32..9a56393e40b4 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -98,7 +98,7 @@ static int system_heap_allocate(struct dma_heap *heap,
 err0:
 	kfree(helper_buffer);
 
-	return -ENOMEM;
+	return ret;
 }
 
 static const struct dma_heap_ops system_heap_ops = {
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: kernel-janitors@vger.kernel.org, Liam Mark <lmark@codeaurora.org>,
	linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org,
	"Andrew F . Davis" <afd@ti.com>,
	Colin King <colin.king@canonical.com>
Subject: [PATCH] dma-buf: heaps: Fix redundant assignment to variable ret in system_heap.c
Date: Wed, 30 Oct 2019 16:30:40 +0000	[thread overview]
Message-ID: <20191030163040.70055-1-john.stultz@linaro.org> (raw)
Message-ID: <20191030163040.jGZ6Es4MbrSwGP6SQX2EoUNqjoHCEdRa5OnKE6lYh98@z> (raw)

Colin King reported a coverity error:
 The variable ret is being assigned with a value that is never
 read, it is being re-assigned the same value on the err0 exit
 path. The assignment is redundant and hence can be removed.

He had a fix, but Andrew Davis suggested a better solution
(actually returning ret), so this patch implements that fix.

Cc: Colin King <colin.king@canonical.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: kernel-janitors@vger.kernel.org
Addresses-Coverity: ("Unused value")
Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
Reported-by: Colin Ian King <colin.king@canonical.com>
Suggested-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/dma-buf/heaps/system_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
index 455782efbb32..9a56393e40b4 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -98,7 +98,7 @@ static int system_heap_allocate(struct dma_heap *heap,
 err0:
 	kfree(helper_buffer);
 
-	return -ENOMEM;
+	return ret;
 }
 
 static const struct dma_heap_ops system_heap_ops = {
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2019-10-30 16:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 16:30 John Stultz [this message]
2019-10-30 16:30 ` [PATCH] dma-buf: heaps: Fix redundant assignment to variable ret in system_heap.c John Stultz

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=20191030163040.70055-1-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=afd@ti.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=brian.starkey@arm.com \
    --cc=colin.king@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=labbott@redhat.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lmark@codeaurora.org \
    --cc=sumit.semwal@linaro.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.