Skip to contentSkip to conversation

git commit --signoff -m "mtd: cadence: Fix cast to pointer from integer of different size warning

PATCH Superseded Vasyl Gomonovych 3 participants 6 messages Dec 14, 2019 – Jan 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git commit --signoff -m "mtd: cadence: Fix cast to pointer from integer of different size warning

Use a cast to uintptr_t and next to a pointer
In the final assignment the same casting in place memory_pointer = (uintptr_t)mem_ptr;
Fix warning: cast to pointer from integer of different size

---
This commit fixes a minor issue with a warning Not sure if we will have problem here in case of dma_addr_t which can be 64-bit wide on 32-bit arch

---
 drivers/mtd/nand/raw/cadence-nand-controller.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/cadence-nand-controller.c +2 -2
index 3a36285a8d8a..960c3a0be69c 100644
@@ -1280,8 +1280,8 @@ cadence_nand_cdma_transfer(struct cdns_nand_ctrl *cdns_ctrl, u8 chip_nr,
 	}
 
 	cadence_nand_cdma_desc_prepare(cdns_ctrl, chip_nr, page,
-				       (void *)dma_buf, (void *)dma_ctrl_dat,
-				       ctype);
+				       (void *)(uintptr_t)dma_buf,
+				       (void *)(uintptr_t)dma_ctrl_dat, ctype);
 
 	status = cadence_nand_cdma_send_and_wait(cdns_ctrl, thread_nr);
 
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Hi Vasyl,

Vasyl Gomonovych <[email protected]> wrote on Sat, 14 Dec 2019 22:09:45 +0100:

Quoted 4 lines

Use a cast to uintptr_t and next to a pointer
In the final assignment the same casting in place memory_pointer = (uintptr_t)mem_ptr;
Fix warning: cast to pointer from integer of different size

It seems like you're 'git send' script is messy :) (see the title).

Quoted 6 lines

---
This commit fixes a minor issue with a warning Not sure if we will have problem here in case of dma_addr_t which can be 64-bit wide on 32-bit arch

Why not manipulating dma_addr_t everywhere instead?

Quoted 10 lines
---
 drivers/mtd/nand/raw/cadence-nand-controller.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/cadence-nand-controller.c +0 -0
index 3a36285a8d8a..960c3a0be69c 100644

drivers/mtd/nand/raw/cadence-nand-controller.c cadence_nand_cdma_transfer(struct cdns_nand_ctrl *cdns_ctrl, u8 chip_nr, · line 1287

Quoted 10 lines
drivers/mtd/nand/raw/cadence-nand-controller.c +2 -2
@@ -1280,8 +1280,8 @@ cadence_nand_cdma_transfer(struct cdns_nand_ctrl *cdns_ctrl, u8 chip_nr,
 	}
 
 	cadence_nand_cdma_desc_prepare(cdns_ctrl, chip_nr, page,
-				       (void *)dma_buf, (void *)dma_ctrl_dat,
-				       ctype);
+				       (void *)(uintptr_t)dma_buf,
+				       (void *)(uintptr_t)dma_ctrl_dat, ctype);
 
 	status = cadence_nand_cdma_send_and_wait(cdns_ctrl, thread_nr);
 

Thanks,
Miquèl

#2 lore raw

PATCH v2 1/1 mtd: cadence: Fix cast to pointer from integer of different size warning

Use dma_addr_t type to pass memory address and control data in DMA descriptor fields memory_pointer and ctrl_data_ptr To fix warning: cast to pointer from integer of different size

---

Changes since v1:
* Remove type casting (void *)(uintptr_t)dma_buf
* Change type of function parameters

 drivers/mtd/nand/raw/cadence-nand-controller.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/mtd/nand/raw/cadence-nand-controller.c +6 -7
index 3a36285a8d8a..f6c7102a1e32 100644
@@ -914,8 +914,8 @@ static void cadence_nand_get_caps(struct cdns_nand_ctrl *cdns_ctrl)
 /* Prepare CDMA descriptor. */
 static void
 cadence_nand_cdma_desc_prepare(struct cdns_nand_ctrl *cdns_ctrl,
-			       char nf_mem, u32 flash_ptr, char *mem_ptr,
-			       char *ctrl_data_ptr, u16 ctype)
+			       char nf_mem, u32 flash_ptr, dma_addr_t mem_ptr,
+				   dma_addr_t ctrl_data_ptr, u16 ctype)
 {
 	struct cadence_nand_cdma_desc *cdma_desc = cdns_ctrl->cdma_desc;
 
@@ -931,13 +931,13 @@ cadence_nand_cdma_desc_prepare(struct cdns_nand_ctrl *cdns_ctrl,
 	cdma_desc->command_flags |= CDMA_CF_DMA_MASTER;
 	cdma_desc->command_flags  |= CDMA_CF_INT;
 
-	cdma_desc->memory_pointer = (uintptr_t)mem_ptr;
+	cdma_desc->memory_pointer = mem_ptr;
 	cdma_desc->status = 0;
 	cdma_desc->sync_flag_pointer = 0;
 	cdma_desc->sync_arguments = 0;
 
 	cdma_desc->command_type = ctype;
-	cdma_desc->ctrl_data_ptr = (uintptr_t)ctrl_data_ptr;
+	cdma_desc->ctrl_data_ptr = ctrl_data_ptr;
 }
 
 static u8 cadence_nand_check_desc_error(struct cdns_nand_ctrl *cdns_ctrl,
@@ -1280,8 +1280,7 @@ cadence_nand_cdma_transfer(struct cdns_nand_ctrl *cdns_ctrl, u8 chip_nr,
 	}
 
 	cadence_nand_cdma_desc_prepare(cdns_ctrl, chip_nr, page,
-				       (void *)dma_buf, (void *)dma_ctrl_dat,
-				       ctype);
+				       dma_buf, dma_ctrl_dat, ctype);
 
 	status = cadence_nand_cdma_send_and_wait(cdns_ctrl, thread_nr);
 
@@ -1360,7 +1359,7 @@ static int cadence_nand_erase(struct nand_chip *chip, u32 page)
 
 	cadence_nand_cdma_desc_prepare(cdns_ctrl,
 				       cdns_chip->cs[chip->cur_cs],
-				       page, NULL, NULL,
+				       page, 0, 0,
 				       CDMA_CT_ERASE);
 	status = cadence_nand_cdma_send_and_wait(cdns_ctrl, thread_nr);
 	if (status) {
Signature · 1 line
2.17.1
Acked-by on v2 1/1
#3 lore raw

Re: [PATCH v2] mtd: cadence: Fix cast to pointer from integer of different size warning

Miquel, this warning is still there both in mainline and linux-next.

Can you please apply it and get it sent in so we can keep the tree building cleaning and spot warnings without the noise? Thanks!

Quoted 6 lines · Vasyl Gomonovych

Use dma_addr_t type to pass memory address and control data in DMA descriptor fields memory_pointer and ctrl_data_ptr To fix warning: cast to pointer from integer of different size

-Olof

maintainer
#4 lore raw

Re: [PATCH v2] mtd: cadence: Fix cast to pointer from integer of different size warning

Hi Olof,

Olof Johansson <[email protected]> wrote on Mon, 6 Jan 2020 13:18:17 -0800:

Quoted 7 lines

Miquel, this warning is still there both in mainline and linux-next.

Can you please apply it and get it sent in so we can keep the tree building cleaning and spot warnings without the noise? Thanks!

Quoted 1 line · Vasyl Gomonovych
Quoted 8 lines
Quoted 5 lines

Use dma_addr_t type to pass memory address and control data in DMA descriptor fields memory_pointer and ctrl_data_ptr To fix warning: cast to pointer from integer of different size

Sorry, I am late. I'll send a fixes PR this week.

Thanks,
Miquèl

maintainer Applied
#5 lore raw

Re: [PATCH v2] mtd: cadence: Fix cast to pointer from integer of different size warning

In reply to Vasyl Gomonovych
Quoted 6 lines · Vasyl Gomonovych

Use dma_addr_t type to pass memory address and control data in DMA descriptor fields memory_pointer and ctrl_data_ptr To fix warning: cast to pointer from integer of different size

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/