linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mmc: sdhci: fix an issue of mixing different types
@ 2020-01-20  3:10 Chunyan Zhang
  2020-01-20  3:32 ` Chunyan Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Chunyan Zhang @ 2020-01-20  3:10 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter
  Cc: Faiz Abbas, Nathan Chancellor, Chunyan Zhang, linux-mmc,
	clang-built-linux, linux-kernel, Chunyan Zhang,
	kbuild test robot

Fix an issue reported by sparse, since mixed types of parameters are
used on calling dmaengine_prep_slave_sg().

Fixes: f9a7c2112165 (mmc: sdhci: Add using external dma)
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
---
Changes from v1:
* address comments from Nathan Chancellor
- define a new variable to avoid type conversions.
---
 drivers/mmc/host/sdhci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 30b5a624b50e..f9e0b5f2c692 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1201,6 +1201,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
 				    struct mmc_command *cmd)
 {
 	int ret, i;
+	enum dma_transfer_direction dir;
 	struct dma_async_tx_descriptor *desc;
 	struct mmc_data *data = cmd->data;
 	struct dma_chan *chan;
@@ -1234,8 +1235,8 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
 	if (sg_cnt <= 0)
 		return -EINVAL;
 
-	desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len,
-				       mmc_get_dma_dir(data),
+	dir = data->flags & MMC_DATA_WRITE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+	desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len, dir,
 				       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc)
 		return -EINVAL;
-- 
2.20.1


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

* [PATCH v2] mmc: sdhci: fix an issue of mixing different types
  2020-01-20  3:10 [PATCH v2] mmc: sdhci: fix an issue of mixing different types Chunyan Zhang
@ 2020-01-20  3:32 ` Chunyan Zhang
  2020-01-20  7:14   ` Adrian Hunter
  0 siblings, 1 reply; 5+ messages in thread
From: Chunyan Zhang @ 2020-01-20  3:32 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter
  Cc: Faiz Abbas, Nathan Chancellor, Chunyan Zhang, linux-mmc,
	clang-built-linux, linux-kernel, Chunyan Zhang,
	kbuild test robot

Fix an issue reported by sparse, since mixed types of parameters are
used on calling dmaengine_prep_slave_sg().

Fixes: 36e1da441fec (mmc: sdhci: add support for using external DMA devices)
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
---
Changes from v1:
* address comments from Nathan Chancellor
- define a new variable to avoid type conversions.
---
 drivers/mmc/host/sdhci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 30b5a624b50e..f9e0b5f2c692 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1201,6 +1201,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
 				    struct mmc_command *cmd)
 {
 	int ret, i;
+	enum dma_transfer_direction dir;
 	struct dma_async_tx_descriptor *desc;
 	struct mmc_data *data = cmd->data;
 	struct dma_chan *chan;
@@ -1234,8 +1235,8 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
 	if (sg_cnt <= 0)
 		return -EINVAL;
 
-	desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len,
-				       mmc_get_dma_dir(data),
+	dir = data->flags & MMC_DATA_WRITE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+	desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len, dir,
 				       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc)
 		return -EINVAL;
-- 
2.20.1


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

* Re: [PATCH v2] mmc: sdhci: fix an issue of mixing different types
  2020-01-20  3:32 ` Chunyan Zhang
@ 2020-01-20  7:14   ` Adrian Hunter
  2020-01-20  8:14     ` Chunyan Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2020-01-20  7:14 UTC (permalink / raw)
  To: Chunyan Zhang, Ulf Hansson
  Cc: Faiz Abbas, Nathan Chancellor, Chunyan Zhang, linux-mmc,
	clang-built-linux, linux-kernel, kbuild test robot

On 20/01/20 5:32 am, Chunyan Zhang wrote:
> Fix an issue reported by sparse, since mixed types of parameters are
> used on calling dmaengine_prep_slave_sg().
> 
> Fixes: 36e1da441fec (mmc: sdhci: add support for using external DMA devices)

That commit number is only in next

> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> Changes from v1:
> * address comments from Nathan Chancellor
> - define a new variable to avoid type conversions.
> ---
>  drivers/mmc/host/sdhci.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 30b5a624b50e..f9e0b5f2c692 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1201,6 +1201,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
>  				    struct mmc_command *cmd)
>  {
>  	int ret, i;
> +	enum dma_transfer_direction dir;
>  	struct dma_async_tx_descriptor *desc;
>  	struct mmc_data *data = cmd->data;
>  	struct dma_chan *chan;
> @@ -1234,8 +1235,8 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
>  	if (sg_cnt <= 0)
>  		return -EINVAL;
>  
> -	desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len,
> -				       mmc_get_dma_dir(data),
> +	dir = data->flags & MMC_DATA_WRITE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
> +	desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len, dir,
>  				       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
>  	if (!desc)
>  		return -EINVAL;
> 


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

* Re: [PATCH v2] mmc: sdhci: fix an issue of mixing different types
  2020-01-20  7:14   ` Adrian Hunter
@ 2020-01-20  8:14     ` Chunyan Zhang
  2020-01-20 11:25       ` Ulf Hansson
  0 siblings, 1 reply; 5+ messages in thread
From: Chunyan Zhang @ 2020-01-20  8:14 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Ulf Hansson, Faiz Abbas, Nathan Chancellor, Chunyan Zhang,
	linux-mmc, clang-built-linux, Linux Kernel Mailing List,
	kbuild test robot

On Mon, 20 Jan 2020 at 15:15, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 20/01/20 5:32 am, Chunyan Zhang wrote:
> > Fix an issue reported by sparse, since mixed types of parameters are
> > used on calling dmaengine_prep_slave_sg().
> >
> > Fixes: 36e1da441fec (mmc: sdhci: add support for using external DMA devices)
>
> That commit number is only in next

Ok, so should this line be removed?

>
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
> > Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Thank you!

Chunyan

>
> > ---
> > Changes from v1:
> > * address comments from Nathan Chancellor
> > - define a new variable to avoid type conversions.
> > ---
> >  drivers/mmc/host/sdhci.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index 30b5a624b50e..f9e0b5f2c692 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -1201,6 +1201,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
> >                                   struct mmc_command *cmd)
> >  {
> >       int ret, i;
> > +     enum dma_transfer_direction dir;
> >       struct dma_async_tx_descriptor *desc;
> >       struct mmc_data *data = cmd->data;
> >       struct dma_chan *chan;
> > @@ -1234,8 +1235,8 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
> >       if (sg_cnt <= 0)
> >               return -EINVAL;
> >
> > -     desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len,
> > -                                    mmc_get_dma_dir(data),
> > +     dir = data->flags & MMC_DATA_WRITE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
> > +     desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len, dir,
> >                                      DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> >       if (!desc)
> >               return -EINVAL;
> >
>

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

* Re: [PATCH v2] mmc: sdhci: fix an issue of mixing different types
  2020-01-20  8:14     ` Chunyan Zhang
@ 2020-01-20 11:25       ` Ulf Hansson
  0 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2020-01-20 11:25 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: Adrian Hunter, Faiz Abbas, Nathan Chancellor, Chunyan Zhang,
	linux-mmc, clang-built-linux, Linux Kernel Mailing List,
	kbuild test robot

On Mon, 20 Jan 2020 at 09:14, Chunyan Zhang <zhang.lyra@gmail.com> wrote:
>
> On Mon, 20 Jan 2020 at 15:15, Adrian Hunter <adrian.hunter@intel.com> wrote:
> >
> > On 20/01/20 5:32 am, Chunyan Zhang wrote:
> > > Fix an issue reported by sparse, since mixed types of parameters are
> > > used on calling dmaengine_prep_slave_sg().
> > >
> > > Fixes: 36e1da441fec (mmc: sdhci: add support for using external DMA devices)
> >
> > That commit number is only in next
>
> Ok, so should this line be removed?

Normally yes, because I may rebase my next branch.

However, at this point in time I am not planning for a rebase, so let's keep it.

>
> >
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > > Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
> > > Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> >
> > Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
> Thank you!
>
> Chunyan

[...]

Applied for next, thanks!

Kind regards
Uffe

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

end of thread, other threads:[~2020-01-20 11:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20  3:10 [PATCH v2] mmc: sdhci: fix an issue of mixing different types Chunyan Zhang
2020-01-20  3:32 ` Chunyan Zhang
2020-01-20  7:14   ` Adrian Hunter
2020-01-20  8:14     ` Chunyan Zhang
2020-01-20 11:25       ` Ulf Hansson

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