Skip to contentSkip to conversation

Pointer Cast to Different Type Warnings in sh_mmcif.c

DISCUSSION Kuninori Morimoto 1 participant 2 messages May 11, 2015 2 messages not in the archive MMC, SD and SDIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi nick

Thank you for your feedback

Quoted 10 lines

Greetings Ulf and others,
I am getting the below build warnings on the latest version of Linus's tree:
drivers/mmc/host/sh_mmcif.c: In function ‘sh_mmcif_request_dma_one’:
drivers/mmc/host/sh_mmcif.c:401:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast ]
(void *)pdata->slave_id_tx :
^
drivers/mmc/host/sh_mmcif.c:402:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast (void *)pdata->slave_id_rx;
After reading and tracing this issue it seems to be a cast for a u64 pointer to a unsigned in the following statement:

Quoted 7 lines

if (pdata)

                slave_data = direction == DMA_MEM_TO_DEV ?
                         (void *)pdata->slave_id_tx :
                        (void *)pdata->slave_id_rx;

I am wondering as the maintainer if this is a warning that doesn't need to re factor the structure definition for sh_mmcif_plat_data to use a u64 data type. Please let me known if I should consider re factoring the structure to clean up these warnings.

I guess this warning happen from 5f48dd0690cbcea3f35b9ef2f05d5468dedc80b0
(mmc: sh_mmcif: remove slave_id settings for DMAEngine)

I didn't check, but does cast issue is solved by this ?

- (void *)pdata->slave_id_tx :
- (void *)pdata->slave_id_rx;
+ (void *)(unsigned long)pdata->slave_id_tx :
+ (void *)(unsigned long)pdata->slave_id_rx;

Best regards
---
Kuninori Morimoto

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hi nick

Thank you for your feedback

Quoted 12 lines
Quoted 12 lines

I guess this warning happen from 5f48dd0690cbcea3f35b9ef2f05d5468dedc80b0
(mmc: sh_mmcif: remove slave_id settings for DMAEngine)

I didn't check, but does cast issue is solved by this ?

(quoted diff) +2 -2
-	(void *)pdata->slave_id_tx :
-	(void *)pdata->slave_id_rx;
+	(void *)(unsigned long)pdata->slave_id_tx :
+	(void *)(unsigned long)pdata->slave_id_rx;
Quoted 8 lines
Quoted 4 lines

Best regards
---
Kuninori Morimoto

Kuninori,
After running a allmodconfig on my machine the warnings are no longer there. Either I can send in a patch fixing this or you can one with my name on a suggested by line, in the signed off part of your patch. The choice is up to you, I don't care either way.

Thank you.
Can you please send this patch ?
I can send Acked-by to your patch.