Re: Pointer Cast to Different Type Warnings in sh_mmcif.c

From: Kuninori Morimoto
Date: Sun May 10 2015 - 23:57:47 EST



Hi nick

Thank you for your feedback

> 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:
>
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/