All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Ben Dooks <ben.dooks@codethink.co.uk>,
	linux-kernel@lists.codethink.co.uk
Cc: Matthew Leach <matt.leach@codethink.co.uk>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field
Date: Thu, 09 Jun 2016 21:28:30 +0900	[thread overview]
Message-ID: <575960EE.8040702@samsung.com> (raw)
In-Reply-To: <1465306639-9537-1-git-send-email-ben.dooks@codethink.co.uk>

Hi Ben,

On 06/07/2016 10:37 PM, Ben Dooks wrote:
> The IDMAC_SET_BUFFER1_SIZE() macro modifies des1, but does
> not check if the value being passed is big or little endian
> desptire the des1 field being marked as __le32.
> 
> Fix the issue by ensuring the values are changed from the
> cpu endian to the descriptor endian by using cpu_to_le32.
> 
> Spotted whilst doing big endian conversion work on Exynos,
> and stops the mmc worker thread from stalling.

Applied this patch. Thanks!

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> Cc: Matthew Leach <matt.leach@codethink.co.uk>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mmc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/mmc/host/dw_mmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 2cc6123..544397e 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -92,7 +92,7 @@ struct idmac_desc {
>  
>  	__le32		des1;	/* Buffer sizes */
>  #define IDMAC_SET_BUFFER1_SIZE(d, s) \
> -	((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
> +	((d)->des1 = ((d)->des1 & cpu_to_le32(0x03ffe000)) | (cpu_to_le32((s) & 0x1fff)))
>  
>  	__le32		des2;	/* buffer 1 physical address */
>  
> 


WARNING: multiple messages have this Message-ID (diff)
From: jh80.chung@samsung.com (Jaehoon Chung)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field
Date: Thu, 09 Jun 2016 21:28:30 +0900	[thread overview]
Message-ID: <575960EE.8040702@samsung.com> (raw)
In-Reply-To: <1465306639-9537-1-git-send-email-ben.dooks@codethink.co.uk>

Hi Ben,

On 06/07/2016 10:37 PM, Ben Dooks wrote:
> The IDMAC_SET_BUFFER1_SIZE() macro modifies des1, but does
> not check if the value being passed is big or little endian
> desptire the des1 field being marked as __le32.
> 
> Fix the issue by ensuring the values are changed from the
> cpu endian to the descriptor endian by using cpu_to_le32.
> 
> Spotted whilst doing big endian conversion work on Exynos,
> and stops the mmc worker thread from stalling.

Applied this patch. Thanks!

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> Cc: Matthew Leach <matt.leach@codethink.co.uk>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mmc at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> ---
>  drivers/mmc/host/dw_mmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 2cc6123..544397e 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -92,7 +92,7 @@ struct idmac_desc {
>  
>  	__le32		des1;	/* Buffer sizes */
>  #define IDMAC_SET_BUFFER1_SIZE(d, s) \
> -	((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
> +	((d)->des1 = ((d)->des1 & cpu_to_le32(0x03ffe000)) | (cpu_to_le32((s) & 0x1fff)))
>  
>  	__le32		des2;	/* buffer 1 physical address */
>  
> 

  parent reply	other threads:[~2016-06-09 12:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20160607133726epcas1p1c3274577f12dbf456a7a6bf3efb6e1fe@epcas1p1.samsung.com>
2016-06-07 13:37 ` [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field Ben Dooks
2016-06-07 13:37   ` Ben Dooks
2016-06-08  9:55   ` Shawn Lin
2016-06-08  9:55     ` Shawn Lin
2016-06-08 10:11     ` Ben Dooks
2016-06-08 10:11       ` Ben Dooks
2016-06-09 12:28   ` Jaehoon Chung [this message]
2016-06-09 12:28     ` Jaehoon Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=575960EE.8040702@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=ben.dooks@codethink.co.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-mmc@vger.kernel.org \
    --cc=matt.leach@codethink.co.uk \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.