linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][dma-next] dmaengine: stm32: remove redundant initialization of hwdesc
@ 2017-10-11 10:28 Colin King
  2017-10-11 12:16 ` Pierre Yves MORDRET
  2017-10-12 14:05 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-10-11 10:28 UTC (permalink / raw)
  To: linux-arm-kernel

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

hwdesc is being initialized to desc->hwdesc but this is never read
as hwdesc is overwritten in a for-loop.  Remove the redundant
initialization and move the declaration of hwdesc into the for-loop.

Cleans up clang warning:
Value stored to 'hwdesc' during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/dma/stm32-mdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
index 0db59a7e80e0..d3be6bffdf12 100644
--- a/drivers/dma/stm32-mdma.c
+++ b/drivers/dma/stm32-mdma.c
@@ -1252,13 +1252,13 @@ static size_t stm32_mdma_desc_residue(struct stm32_mdma_chan *chan,
 				      u32 curr_hwdesc)
 {
 	struct stm32_mdma_device *dmadev = stm32_mdma_get_dev(chan);
-	struct stm32_mdma_hwdesc *hwdesc = desc->hwdesc;
 	u32 cbndtr, residue, modulo, burst_size;
 	int i;
 
 	residue = 0;
 	for (i = curr_hwdesc + 1; i < desc->count; i++) {
-		hwdesc = &desc->hwdesc[i];
+		struct stm32_mdma_hwdesc *hwdesc = &desc->hwdesc[i];
+
 		residue += STM32_MDMA_CBNDTR_BNDT(hwdesc->cbndtr);
 	}
 	cbndtr = stm32_mdma_read(dmadev, STM32_MDMA_CBNDTR(chan->id));
-- 
2.14.1

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

* [PATCH][dma-next] dmaengine: stm32: remove redundant initialization of hwdesc
  2017-10-11 10:28 [PATCH][dma-next] dmaengine: stm32: remove redundant initialization of hwdesc Colin King
@ 2017-10-11 12:16 ` Pierre Yves MORDRET
  2017-10-12 14:05 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre Yves MORDRET @ 2017-10-11 12:16 UTC (permalink / raw)
  To: linux-arm-kernel


On 10/11/2017 12:28 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> hwdesc is being initialized to desc->hwdesc but this is never read
> as hwdesc is overwritten in a for-loop.  Remove the redundant
> initialization and move the declaration of hwdesc into the for-loop.
> 
> Cleans up clang warning:
> Value stored to 'hwdesc' during its initialization is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/dma/stm32-mdma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
> index 0db59a7e80e0..d3be6bffdf12 100644
> --- a/drivers/dma/stm32-mdma.c
> +++ b/drivers/dma/stm32-mdma.c
> @@ -1252,13 +1252,13 @@ static size_t stm32_mdma_desc_residue(struct stm32_mdma_chan *chan,
>  				      u32 curr_hwdesc)
>  {
>  	struct stm32_mdma_device *dmadev = stm32_mdma_get_dev(chan);
> -	struct stm32_mdma_hwdesc *hwdesc = desc->hwdesc;
>  	u32 cbndtr, residue, modulo, burst_size;
>  	int i;
>  
>  	residue = 0;
>  	for (i = curr_hwdesc + 1; i < desc->count; i++) {
> -		hwdesc = &desc->hwdesc[i];
> +		struct stm32_mdma_hwdesc *hwdesc = &desc->hwdesc[i];
> +
>  		residue += STM32_MDMA_CBNDTR_BNDT(hwdesc->cbndtr);
>  	}
>  	cbndtr = stm32_mdma_read(dmadev, STM32_MDMA_CBNDTR(chan->id));
> 

Acked-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>

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

* [PATCH][dma-next] dmaengine: stm32: remove redundant initialization of hwdesc
  2017-10-11 10:28 [PATCH][dma-next] dmaengine: stm32: remove redundant initialization of hwdesc Colin King
  2017-10-11 12:16 ` Pierre Yves MORDRET
@ 2017-10-12 14:05 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2017-10-12 14:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 11, 2017 at 11:28:22AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> hwdesc is being initialized to desc->hwdesc but this is never read
> as hwdesc is overwritten in a for-loop.  Remove the redundant
> initialization and move the declaration of hwdesc into the for-loop.
> 
> Cleans up clang warning:
> Value stored to 'hwdesc' during its initialization is never read

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2017-10-12 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-11 10:28 [PATCH][dma-next] dmaengine: stm32: remove redundant initialization of hwdesc Colin King
2017-10-11 12:16 ` Pierre Yves MORDRET
2017-10-12 14:05 ` Vinod Koul

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).