mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: cqhci: fix to missed endian conversions
@ 2026-06-22 14:50 Ben Dooks
  2026-06-23  9:48 ` Adrian Hunter
  2026-07-06 15:47 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Dooks @ 2026-06-22 14:50 UTC (permalink / raw)
  To: Adrian Hunter, Asutosh Das, Ritesh Harjani, Ulf Hansson,
	linux-mmc, linux-kernel
  Cc: Ben Dooks

Fix two places where the wrong type or conversion of little-endian
types to fix the following sparse warnings:

drivers/mmc/host/cqhci-core.c:487:15: warning: incorrect type in assignment (different base types)
drivers/mmc/host/cqhci-core.c:487:15:    expected restricted __le32 [usertype]
drivers/mmc/host/cqhci-core.c:487:15:    got int
drivers/mmc/host/cqhci-core.c:566:19: warning: incorrect type in assignment (different base types)
drivers/mmc/host/cqhci-core.c:566:19:    expected unsigned long long [usertype] *task_desc
drivers/mmc/host/cqhci-core.c:566:19:    got restricted __le64 [usertype] *

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 drivers/mmc/host/cqhci-core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
index 178277d90c31..00614b500b2b 100644
--- a/drivers/mmc/host/cqhci-core.c
+++ b/drivers/mmc/host/cqhci-core.c
@@ -484,11 +484,11 @@ void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
 {
 	__le32 *attr = (__le32 __force *)desc;
 
-	*attr = (CQHCI_VALID(1) |
-		 CQHCI_END(end ? 1 : 0) |
-		 CQHCI_INT(0) |
-		 CQHCI_ACT(0x4) |
-		 CQHCI_DAT_LENGTH(len));
+	*attr = cpu_to_le32((CQHCI_VALID(1) |
+			     CQHCI_END(end ? 1 : 0) |
+			     CQHCI_INT(0) |
+			     CQHCI_ACT(0x4) |
+			     CQHCI_DAT_LENGTH(len)));
 
 	if (dma64) {
 		__le64 *dataddr = (__le64 __force *)(desc + 4);
@@ -542,7 +542,7 @@ static int cqhci_prep_tran_desc(struct mmc_request *mrq,
 static void cqhci_prep_dcmd_desc(struct mmc_host *mmc,
 				   struct mmc_request *mrq)
 {
-	u64 *task_desc = NULL;
+	__le64 *task_desc = NULL;
 	u64 data = 0;
 	u8 resp_type;
 	u8 *desc;
@@ -574,7 +574,7 @@ static void cqhci_prep_dcmd_desc(struct mmc_host *mmc,
 		 CQHCI_CMD_TIMING(timing) | CQHCI_RESP_TYPE(resp_type));
 	if (cq_host->ops->update_dcmd_desc)
 		cq_host->ops->update_dcmd_desc(mmc, mrq, &data);
-	*task_desc |= data;
+	*task_desc |= cpu_to_le64(data);
 	desc = (u8 *)task_desc;
 	pr_debug("%s: cqhci: dcmd: cmd: %d timing: %d resp: %d\n",
 		 mmc_hostname(mmc), mrq->cmd->opcode, timing, resp_type);
-- 
2.37.2.352.g3c44437643


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

* Re: [PATCH] mmc: cqhci: fix to missed endian conversions
  2026-06-22 14:50 [PATCH] mmc: cqhci: fix to missed endian conversions Ben Dooks
@ 2026-06-23  9:48 ` Adrian Hunter
  2026-07-06 15:47 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2026-06-23  9:48 UTC (permalink / raw)
  To: Ben Dooks, Asutosh Das, Ritesh Harjani, Ulf Hansson, linux-mmc,
	linux-kernel

On 22/06/2026 17:50, Ben Dooks wrote:
> Fix two places where the wrong type or conversion of little-endian
> types to fix the following sparse warnings:
> 
> drivers/mmc/host/cqhci-core.c:487:15: warning: incorrect type in assignment (different base types)
> drivers/mmc/host/cqhci-core.c:487:15:    expected restricted __le32 [usertype]
> drivers/mmc/host/cqhci-core.c:487:15:    got int
> drivers/mmc/host/cqhci-core.c:566:19: warning: incorrect type in assignment (different base types)
> drivers/mmc/host/cqhci-core.c:566:19:    expected unsigned long long [usertype] *task_desc
> drivers/mmc/host/cqhci-core.c:566:19:    got restricted __le64 [usertype] *
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

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

> ---
>  drivers/mmc/host/cqhci-core.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
> index 178277d90c31..00614b500b2b 100644
> --- a/drivers/mmc/host/cqhci-core.c
> +++ b/drivers/mmc/host/cqhci-core.c
> @@ -484,11 +484,11 @@ void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
>  {
>  	__le32 *attr = (__le32 __force *)desc;
>  
> -	*attr = (CQHCI_VALID(1) |
> -		 CQHCI_END(end ? 1 : 0) |
> -		 CQHCI_INT(0) |
> -		 CQHCI_ACT(0x4) |
> -		 CQHCI_DAT_LENGTH(len));
> +	*attr = cpu_to_le32((CQHCI_VALID(1) |
> +			     CQHCI_END(end ? 1 : 0) |
> +			     CQHCI_INT(0) |
> +			     CQHCI_ACT(0x4) |
> +			     CQHCI_DAT_LENGTH(len)));
>  
>  	if (dma64) {
>  		__le64 *dataddr = (__le64 __force *)(desc + 4);
> @@ -542,7 +542,7 @@ static int cqhci_prep_tran_desc(struct mmc_request *mrq,
>  static void cqhci_prep_dcmd_desc(struct mmc_host *mmc,
>  				   struct mmc_request *mrq)
>  {
> -	u64 *task_desc = NULL;
> +	__le64 *task_desc = NULL;
>  	u64 data = 0;
>  	u8 resp_type;
>  	u8 *desc;
> @@ -574,7 +574,7 @@ static void cqhci_prep_dcmd_desc(struct mmc_host *mmc,
>  		 CQHCI_CMD_TIMING(timing) | CQHCI_RESP_TYPE(resp_type));
>  	if (cq_host->ops->update_dcmd_desc)
>  		cq_host->ops->update_dcmd_desc(mmc, mrq, &data);
> -	*task_desc |= data;
> +	*task_desc |= cpu_to_le64(data);
>  	desc = (u8 *)task_desc;
>  	pr_debug("%s: cqhci: dcmd: cmd: %d timing: %d resp: %d\n",
>  		 mmc_hostname(mmc), mrq->cmd->opcode, timing, resp_type);


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

* Re: [PATCH] mmc: cqhci: fix to missed endian conversions
  2026-06-22 14:50 [PATCH] mmc: cqhci: fix to missed endian conversions Ben Dooks
  2026-06-23  9:48 ` Adrian Hunter
@ 2026-07-06 15:47 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2026-07-06 15:47 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Adrian Hunter, Asutosh Das, Ritesh Harjani, Ulf Hansson,
	linux-mmc, linux-kernel

On Mon, Jun 22, 2026 at 4:50 PM Ben Dooks <ben.dooks@codethink.co.uk> wrote:
>
> Fix two places where the wrong type or conversion of little-endian
> types to fix the following sparse warnings:
>
> drivers/mmc/host/cqhci-core.c:487:15: warning: incorrect type in assignment (different base types)
> drivers/mmc/host/cqhci-core.c:487:15:    expected restricted __le32 [usertype]
> drivers/mmc/host/cqhci-core.c:487:15:    got int
> drivers/mmc/host/cqhci-core.c:566:19: warning: incorrect type in assignment (different base types)
> drivers/mmc/host/cqhci-core.c:566:19:    expected unsigned long long [usertype] *task_desc
> drivers/mmc/host/cqhci-core.c:566:19:    got restricted __le64 [usertype] *
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/cqhci-core.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
> index 178277d90c31..00614b500b2b 100644
> --- a/drivers/mmc/host/cqhci-core.c
> +++ b/drivers/mmc/host/cqhci-core.c
> @@ -484,11 +484,11 @@ void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
>  {
>         __le32 *attr = (__le32 __force *)desc;
>
> -       *attr = (CQHCI_VALID(1) |
> -                CQHCI_END(end ? 1 : 0) |
> -                CQHCI_INT(0) |
> -                CQHCI_ACT(0x4) |
> -                CQHCI_DAT_LENGTH(len));
> +       *attr = cpu_to_le32((CQHCI_VALID(1) |
> +                            CQHCI_END(end ? 1 : 0) |
> +                            CQHCI_INT(0) |
> +                            CQHCI_ACT(0x4) |
> +                            CQHCI_DAT_LENGTH(len)));
>
>         if (dma64) {
>                 __le64 *dataddr = (__le64 __force *)(desc + 4);
> @@ -542,7 +542,7 @@ static int cqhci_prep_tran_desc(struct mmc_request *mrq,
>  static void cqhci_prep_dcmd_desc(struct mmc_host *mmc,
>                                    struct mmc_request *mrq)
>  {
> -       u64 *task_desc = NULL;
> +       __le64 *task_desc = NULL;
>         u64 data = 0;
>         u8 resp_type;
>         u8 *desc;
> @@ -574,7 +574,7 @@ static void cqhci_prep_dcmd_desc(struct mmc_host *mmc,
>                  CQHCI_CMD_TIMING(timing) | CQHCI_RESP_TYPE(resp_type));
>         if (cq_host->ops->update_dcmd_desc)
>                 cq_host->ops->update_dcmd_desc(mmc, mrq, &data);
> -       *task_desc |= data;
> +       *task_desc |= cpu_to_le64(data);
>         desc = (u8 *)task_desc;
>         pr_debug("%s: cqhci: dcmd: cmd: %d timing: %d resp: %d\n",
>                  mmc_hostname(mmc), mrq->cmd->opcode, timing, resp_type);
> --
> 2.37.2.352.g3c44437643
>

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

end of thread, other threads:[~2026-07-06 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-22 14:50 [PATCH] mmc: cqhci: fix to missed endian conversions Ben Dooks
2026-06-23  9:48 ` Adrian Hunter
2026-07-06 15:47 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox