devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA
@ 2022-04-26 10:19 Akhil R
  2022-04-26 10:19 ` [PATCH v2 1/2] dmaengine: tegra: Fix uninitialized variable usage Akhil R
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Akhil R @ 2022-04-26 10:19 UTC (permalink / raw)
  To: devicetree, dmaengine, jonathanh, kyarlagadda, ldewangan,
	linux-kernel, linux-tegra, p.zabel, rgumasta, robh+dt,
	thierry.reding, nathan, vkoul, dan.carpenter
  Cc: akhilrajeev

Initialize uninitialized variable and remove unused switch case
in tegra186-gpcdma driver.

v1->v2: Split the patches to separate 'fixes'.

Akhil R (2):
  dmaengine: tegra: Fix uninitialized variable usage
  dmaengine: tegra: Remove unused switch case

 drivers/dma/tegra186-gpc-dma.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

-- 
2.17.1


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

* [PATCH v2 1/2] dmaengine: tegra: Fix uninitialized variable usage
  2022-04-26 10:19 [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA Akhil R
@ 2022-04-26 10:19 ` Akhil R
  2022-04-26 10:19 ` [PATCH v2 2/2] dmaengine: tegra: Remove unused switch case Akhil R
  2022-05-19 18:05 ` [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Akhil R @ 2022-04-26 10:19 UTC (permalink / raw)
  To: devicetree, dmaengine, jonathanh, kyarlagadda, ldewangan,
	linux-kernel, linux-tegra, p.zabel, rgumasta, robh+dt,
	thierry.reding, nathan, vkoul, dan.carpenter
  Cc: akhilrajeev

Initialize slave_bw in dma_prep*() functions as the parameter is not
set for DMA_MEM_TO_MEM case in get_transfer_param(). Though the case
may never occur, initializing it avoids warning from certain static
checkers

Fixes: ee17028009d4 ("dmaengine: tegra: Add tegra gpcdma driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
 drivers/dma/tegra186-gpc-dma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index f12327732041..a0dbafa07ec9 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -985,8 +985,8 @@ tegra_dma_prep_slave_sg(struct dma_chan *dc, struct scatterlist *sgl,
 {
 	struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
 	unsigned int max_dma_count = tdc->tdma->chip_data->max_dma_count;
+	enum dma_slave_buswidth slave_bw = DMA_SLAVE_BUSWIDTH_UNDEFINED;
 	u32 csr, mc_seq, apb_ptr = 0, mmio_seq = 0;
-	enum dma_slave_buswidth slave_bw;
 	struct tegra_dma_sg_req *sg_req;
 	struct tegra_dma_desc *dma_desc;
 	struct scatterlist *sg;
@@ -1103,12 +1103,12 @@ tegra_dma_prep_dma_cyclic(struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_l
 			  size_t period_len, enum dma_transfer_direction direction,
 			  unsigned long flags)
 {
+	enum dma_slave_buswidth slave_bw = DMA_SLAVE_BUSWIDTH_UNDEFINED;
+	u32 csr, mc_seq, apb_ptr = 0, mmio_seq = 0, burst_size;
+	unsigned int max_dma_count, len, period_count, i;
 	struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
 	struct tegra_dma_desc *dma_desc;
 	struct tegra_dma_sg_req *sg_req;
-	enum dma_slave_buswidth slave_bw;
-	u32 csr, mc_seq, apb_ptr = 0, mmio_seq = 0, burst_size;
-	unsigned int max_dma_count, len, period_count, i;
 	dma_addr_t mem = buf_addr;
 	int ret;
 
-- 
2.17.1


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

* [PATCH v2 2/2] dmaengine: tegra: Remove unused switch case
  2022-04-26 10:19 [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA Akhil R
  2022-04-26 10:19 ` [PATCH v2 1/2] dmaengine: tegra: Fix uninitialized variable usage Akhil R
@ 2022-04-26 10:19 ` Akhil R
  2022-05-19 18:05 ` [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Akhil R @ 2022-04-26 10:19 UTC (permalink / raw)
  To: devicetree, dmaengine, jonathanh, kyarlagadda, ldewangan,
	linux-kernel, linux-tegra, p.zabel, rgumasta, robh+dt,
	thierry.reding, nathan, vkoul, dan.carpenter
  Cc: akhilrajeev

Remove unused switch case in get_transfer_param() function.
The function is not called for MEM_TO_MEM transfers.

Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
 drivers/dma/tegra186-gpc-dma.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index a0dbafa07ec9..6b8d34165176 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -830,10 +830,6 @@ static int get_transfer_param(struct tegra_dma_channel *tdc,
 		*slave_bw = tdc->dma_sconfig.src_addr_width;
 		*csr = TEGRA_GPCDMA_CSR_DMA_IO2MEM_FC;
 		return 0;
-	case DMA_MEM_TO_MEM:
-		*burst_size = tdc->dma_sconfig.src_addr_width;
-		*csr = TEGRA_GPCDMA_CSR_DMA_MEM2MEM;
-		return 0;
 	default:
 		dev_err(tdc2dev(tdc), "DMA direction is not supported\n");
 	}
-- 
2.17.1


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

* Re: [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA
  2022-04-26 10:19 [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA Akhil R
  2022-04-26 10:19 ` [PATCH v2 1/2] dmaengine: tegra: Fix uninitialized variable usage Akhil R
  2022-04-26 10:19 ` [PATCH v2 2/2] dmaengine: tegra: Remove unused switch case Akhil R
@ 2022-05-19 18:05 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2022-05-19 18:05 UTC (permalink / raw)
  To: Akhil R
  Cc: devicetree, dmaengine, jonathanh, kyarlagadda, ldewangan,
	linux-kernel, linux-tegra, p.zabel, rgumasta, robh+dt,
	thierry.reding, nathan, dan.carpenter

On 26-04-22, 15:49, Akhil R wrote:
> Initialize uninitialized variable and remove unused switch case
> in tegra186-gpcdma driver.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2022-05-19 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-26 10:19 [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA Akhil R
2022-04-26 10:19 ` [PATCH v2 1/2] dmaengine: tegra: Fix uninitialized variable usage Akhil R
2022-04-26 10:19 ` [PATCH v2 2/2] dmaengine: tegra: Remove unused switch case Akhil R
2022-05-19 18:05 ` [PATCH v2 0/2] Fix uninitialized variable usage in Tegra GPCDMA 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).