Skip to contentSkip to conversation

dmaengine: Remove redundant initialization of variable err

PATCH Applied Colin King 2 participants 2 messages Oct 15, 2021 – Oct 18, 2021

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 dmaengine: Remove redundant initialization of variable err

From: Colin Ian King <[email protected]>

The variable err is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed and move the declaration into the local scope.

Addresses-Coverity: ("Unused value")

---
 drivers/dma/dmaengine.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/dmaengine.c +1 -2
index af3ee288bc11..d9f7c097cfd6 100644
@@ -695,13 +695,12 @@ static struct dma_chan *find_candidate(struct dma_device *device,
  */
 struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
 {
-	int err = -EBUSY;
-
 	/* lock against __dma_request_channel */
 	mutex_lock(&dma_list_mutex);
 
 	if (chan->client_count == 0) {
 		struct dma_device *device = chan->device;
+		int err;
 
 		dma_cap_set(DMA_PRIVATE, device->cap_mask);
 		device->privatecnt++;
Signature · 1 line
2.32.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The variable err is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed and move the declaration into the local scope.

Applied, thanks

Signature · 1 line
~Vinod