linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-buf: remove redundant initialization of sg_table
@ 2017-09-14 23:05 Colin King
  2017-09-15  8:48 ` Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-09-14 23:05 UTC (permalink / raw)
  To: Sumit Semwal, linux-media, dri-devel
  Cc: kernel-janitors, linaro-mm-sig, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

sg_table is being initialized and is never read before it is updated
again later on, hence making the initialization redundant. Remove
the initialization.

Detected by clang scan-build:
"warning: Value stored to 'sg_table' during its initialization is
never read"

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/dma-buf/dma-buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 4a038dcf5361..bc1cb284111c 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -625,7 +625,7 @@ EXPORT_SYMBOL_GPL(dma_buf_detach);
 struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
 					enum dma_data_direction direction)
 {
-	struct sg_table *sg_table = ERR_PTR(-EINVAL);
+	struct sg_table *sg_table;
 
 	might_sleep();
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dma-buf: remove redundant initialization of sg_table
  2017-09-14 23:05 [PATCH] dma-buf: remove redundant initialization of sg_table Colin King
@ 2017-09-15  8:48 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2017-09-15  8:48 UTC (permalink / raw)
  To: Colin King, Sumit Semwal, linux-media, dri-devel
  Cc: linaro-mm-sig, kernel-janitors, linux-kernel

Quoting Colin King (2017-09-15 00:05:16)
> From: Colin Ian King <colin.king@canonical.com>
> 
> sg_table is being initialized and is never read before it is updated
> again later on, hence making the initialization redundant. Remove
> the initialization.
> 
> Detected by clang scan-build:
> "warning: Value stored to 'sg_table' during its initialization is
> never read"
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-15  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-14 23:05 [PATCH] dma-buf: remove redundant initialization of sg_table Colin King
2017-09-15  8:48 ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).