Re: [PATCH 23/30] staging: mt7621-mmc: Remove initialisation in msdc_dma_config

2018-04-29 Thread NeilBrown
On Sun, Apr 29 2018, Christian Lütke-Stetzkamp wrote:

> Current code initialises the variable sg at the beginning of the
> msdc_dma_config function. This is not necessary, because the variable
> is assigned by the for_each_sg macro later on.

But it isn't only used by the for_each_sg macro.

switch (dma->mode) {
case MSDC_MODE_DMA_BASIC:
BUG_ON(host->xfer_size > 65535);
BUG_ON(dma->sglen != 1);
sdr_write32(MSDC_DMA_SA, PHYSADDR(sg_dma_address(sg)));

This now references an uninitialized variable, as do several other
places.

Maybe you could move the initialization into the MSDC_MODE_DMA_BASIC
case.


Thanks,
NeilBrown



>
> Signed-off-by: Christian Lütke-Stetzkamp 
> ---
>  drivers/staging/mt7621-mmc/sd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
> index a2dce54e386c..c9f0180f3220 100644
> --- a/drivers/staging/mt7621-mmc/sd.c
> +++ b/drivers/staging/mt7621-mmc/sd.c
> @@ -1091,7 +1091,7 @@ static int msdc_dma_config(struct msdc_host *host, 
> struct msdc_dma *dma)
>   void __iomem *base = host->base;
>   //u32 i, j, num, bdlen, arg, xfersz;
>   u32 j, num;
> - struct scatterlist *sg = dma->sg;
> + struct scatterlist *sg;
>   struct gpd *gpd;
>   struct bd *bd;
>  
> -- 
> 2.16.1


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 23/30] staging: mt7621-mmc: Remove initialisation in msdc_dma_config

2018-04-29 Thread Christian Lütke-Stetzkamp
Current code initialises the variable sg at the beginning of the
msdc_dma_config function. This is not necessary, because the variable
is assigned by the for_each_sg macro later on.

Signed-off-by: Christian Lütke-Stetzkamp 
---
 drivers/staging/mt7621-mmc/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index a2dce54e386c..c9f0180f3220 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -1091,7 +1091,7 @@ static int msdc_dma_config(struct msdc_host *host, struct 
msdc_dma *dma)
void __iomem *base = host->base;
//u32 i, j, num, bdlen, arg, xfersz;
u32 j, num;
-   struct scatterlist *sg = dma->sg;
+   struct scatterlist *sg;
struct gpd *gpd;
struct bd *bd;
 
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel