Skip to contentSkip to conversation

dma: fix returnvar.cocci warnings

PATCH In review Julia Lawall 5 participants 7 messages Nov 8, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma: fix returnvar.cocci warnings

Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

---

 hidma_ll.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/dma/qcom/hidma_ll.c +2 -4
@@ -567,14 +567,13 @@ int hidma_ll_resume(struct hidma_lldev *
 
 static int hidma_ll_hw_start(struct hidma_lldev *lldev)
 {
-	int rc = 0;
 	unsigned long irqflags;
 
 	spin_lock_irqsave(&lldev->lock, irqflags);
 	writel(lldev->tre_write_offset, lldev->trca + TRCA_DOORBELL_OFFSET);
 	spin_unlock_irqrestore(&lldev->lock, irqflags);
 
-	return rc;
+	return 0;
 }
 
 bool hidma_ll_isenabled(struct hidma_lldev *lldev)
@@ -600,7 +599,6 @@ bool hidma_ll_isenabled(struct hidma_lld
 int hidma_ll_queue_request(struct hidma_lldev *lldev, u32 tre_ch)
 {
 	struct hidma_tre *tre;
-	int rc = 0;
 	unsigned long flags;
 
 	tre = &lldev->trepool[tre_ch];
@@ -618,7 +616,7 @@ int hidma_ll_queue_request(struct hidma_
 	lldev->tre_write_offset = (lldev->tre_write_offset + TRE_SIZE)
 				% lldev->tre_ring_size;
 	spin_unlock_irqrestore(&lldev->lock, flags);
-	return rc;
+	return 0;
 }
 
 int hidma_ll_start(struct hidma_lldev *lldev)
#1 lore raw
Quoted 6 lines · Julia Lawall

Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Who is the author?
I suppose Fengguang is the reporter, right?

Quoted 45 lines

---

 hidma_ll.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/dma/qcom/hidma_ll.c +2 -5
@@ -567,14 +567,13 @@ int hidma_ll_resume(struct hidma_lldev *
 
 static int hidma_ll_hw_start(struct hidma_lldev *lldev)
 {
-       int rc = 0;
        unsigned long irqflags;
 
        spin_lock_irqsave(&lldev->lock, irqflags);
        writel(lldev->tre_write_offset, lldev->trca + TRCA_DOORBELL_OFFSET);
        spin_unlock_irqrestore(&lldev->lock, irqflags);
 
-       return rc;
+       return 0;
 }
 
 bool hidma_ll_isenabled(struct hidma_lldev *lldev)
@@ -600,7 +599,6 @@ bool hidma_ll_isenabled(struct hidma_lld
 int hidma_ll_queue_request(struct hidma_lldev *lldev, u32 tre_ch)
 {
        struct hidma_tre *tre;
-       int rc = 0;
        unsigned long flags;
 
        tre = &lldev->trepool[tre_ch];
@@ -618,7 +616,7 @@ int hidma_ll_queue_request(struct hidma_
        lldev->tre_write_offset = (lldev->tre_write_offset + TRE_SIZE)
                                % lldev->tre_ring_size;
        spin_unlock_irqrestore(&lldev->lock, flags);
-       return rc;
+       return 0;
 }
 
 int hidma_ll_start(struct hidma_lldev *lldev)
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Julia Lawall

Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Sorry for the oversight.

julia

Quoted 56 lines

Who is the author?
I suppose Fengguang is the reporter, right?

Quoted 41 lines

---

 hidma_ll.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/dma/qcom/hidma_ll.c +2 -5
@@ -567,14 +567,13 @@ int hidma_ll_resume(struct hidma_lldev *
 
 static int hidma_ll_hw_start(struct hidma_lldev *lldev)
 {
-       int rc = 0;
        unsigned long irqflags;
 
        spin_lock_irqsave(&lldev->lock, irqflags);
        writel(lldev->tre_write_offset, lldev->trca + TRCA_DOORBELL_OFFSET);
        spin_unlock_irqrestore(&lldev->lock, irqflags);
 
-       return rc;
+       return 0;
 }
 
 bool hidma_ll_isenabled(struct hidma_lldev *lldev)
@@ -600,7 +599,6 @@ bool hidma_ll_isenabled(struct hidma_lld
 int hidma_ll_queue_request(struct hidma_lldev *lldev, u32 tre_ch)
 {
        struct hidma_tre *tre;
-       int rc = 0;
        unsigned long flags;
 
        tre = &lldev->trepool[tre_ch];
@@ -618,7 +616,7 @@ int hidma_ll_queue_request(struct hidma_
        lldev->tre_write_offset = (lldev->tre_write_offset + TRE_SIZE)
                                % lldev->tre_ring_size;
        spin_unlock_irqrestore(&lldev->lock, flags);
-       return rc;
+       return 0;
 }
 
 int hidma_ll_start(struct hidma_lldev *lldev)
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
With Best Regards,
Andy Shevchenko

#3 lore raw
In reply to Andy Shevchenko
Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Julia Lawall

Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Who is the author?
I suppose Fengguang is the reporter, right?

There is no human author... But normally when I check these I add a signed off by line to them.

julia

Quoted 53 lines
Quoted 42 lines

---

 hidma_ll.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/dma/qcom/hidma_ll.c +2 -5
@@ -567,14 +567,13 @@ int hidma_ll_resume(struct hidma_lldev *
 
 static int hidma_ll_hw_start(struct hidma_lldev *lldev)
 {
-       int rc = 0;
        unsigned long irqflags;
 
        spin_lock_irqsave(&lldev->lock, irqflags);
        writel(lldev->tre_write_offset, lldev->trca + TRCA_DOORBELL_OFFSET);
        spin_unlock_irqrestore(&lldev->lock, irqflags);
 
-       return rc;
+       return 0;
 }
 
 bool hidma_ll_isenabled(struct hidma_lldev *lldev)
@@ -600,7 +599,6 @@ bool hidma_ll_isenabled(struct hidma_lld
 int hidma_ll_queue_request(struct hidma_lldev *lldev, u32 tre_ch)
 {
        struct hidma_tre *tre;
-       int rc = 0;
        unsigned long flags;
 
        tre = &lldev->trepool[tre_ch];
@@ -618,7 +616,7 @@ int hidma_ll_queue_request(struct hidma_
        lldev->tre_write_offset = (lldev->tre_write_offset + TRE_SIZE)
                                % lldev->tre_ring_size;
        spin_unlock_irqrestore(&lldev->lock, flags);
-       return rc;
+       return 0;
 }
 
 int hidma_ll_start(struct hidma_lldev *lldev)
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
With Best Regards,
Andy Shevchenko

#4 lore raw
In reply to Andy Shevchenko
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines
Quoted 2 lines

Who is the author?
I suppose Fengguang is the reporter, right?

These are Julia Lawall's coccinelle scripts that automatically run on patches and report problems. Just treat them like normal code reviews and incorporate the change in the next version of your patch.

Signature · 3 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
#5 lore raw
In reply to Julia Lawall
Quoted 10 lines · Julia Lawall

Remove unneeded variable used to store return value.

drivers/dma/qcom/hidma_ll.c +0 -1
@@ -567,14 +567,13 @@ int hidma_ll_resume(struct hidma_lldev *
 
 static int hidma_ll_hw_start(struct hidma_lldev *lldev)
 {
-	int rc = 0;
 	unsigned long irqflags;

drivers/dma/qcom/hidma_ll.c int hidma_ll_resume(struct hidma_lldev * · line 579

Quoted 10 lines
drivers/dma/qcom/hidma_ll.c +1 -1
 
 	spin_lock_irqsave(&lldev->lock, irqflags);
 	writel(lldev->tre_write_offset, lldev->trca + TRCA_DOORBELL_OFFSET);
 	spin_unlock_irqrestore(&lldev->lock, irqflags);
 
-	return rc;
+	return 0;
 }
 
 bool hidma_ll_isenabled(struct hidma_lldev *lldev)

Seems rather pointless, what about 'static void ...' and dropping the return statement?

Daniel K.

#6 lore raw
Quoted 20 lines · Daniel K.
Quoted 19 lines · Julia Lawall

Remove unneeded variable used to store return value.

drivers/dma/qcom/hidma_ll.c +1 -2
@@ -567,14 +567,13 @@ int hidma_ll_resume(struct hidma_lldev *
 
  static int hidma_ll_hw_start(struct hidma_lldev *lldev)
  {
-	int rc = 0;
  	unsigned long irqflags;
 
  	spin_lock_irqsave(&lldev->lock, irqflags);
  	writel(lldev->tre_write_offset, lldev->trca + TRCA_DOORBELL_OFFSET);
  	spin_unlock_irqrestore(&lldev->lock, irqflags);
 
-	return rc;
+	return 0;
  }
 
Quoted 8 lines

drivers/dma/qcom/hidma_ll.c int hidma_ll_resume(struct hidma_lldev * · line 579

Quoted 1 line
drivers/dma/qcom/hidma_ll.c +0 -0
  bool hidma_ll_isenabled(struct hidma_lldev *lldev)

Seems rather pointless, what about 'static void ...' and dropping the return statement?

Daniel K.

Yes, that's what I ended up doing. rc was forgotten there because I had to restructure code to use the issue_pending API.

Signature · 4 lines
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project