Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1732634 > unrolled thread

[PATCH] dma-buf: remove redundant initialization of sg_table

Started byColin King <colin.king@canonical.com>
First post2017-09-15 01:10 +0200
Last post2017-09-15 10:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] dma-buf: remove redundant initialization of sg_table Colin King <colin.king@canonical.com> - 2017-09-15 01:10 +0200
    Re: [PATCH] dma-buf: remove redundant initialization of sg_table Chris Wilson <chris@chris-wilson.co.uk> - 2017-09-15 10:50 +0200

#1732634 — [PATCH] dma-buf: remove redundant initialization of sg_table

FromColin King <colin.king@canonical.com>
Date2017-09-15 01:10 +0200
Subject[PATCH] dma-buf: remove redundant initialization of sg_table
Message-ID<upLqG-2Uj-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1732782

FromChris Wilson <chris@chris-wilson.co.uk>
Date2017-09-15 10:50 +0200
Message-ID<upUtX-mr-7@gated-at.bofh.it>
In reply to#1732634
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web