All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: cadence: use fdt32_t for DT property value to fix sparse warning
@ 2017-06-22  8:58 ` Masahiro Yamada
  2017-06-29  9:46   ` Jaehoon Chung
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2017-06-22  8:58 UTC (permalink / raw)
  To: u-boot

DTB is encoded in big endian.  When we retrieve property values,
we need to use fdt32_to_cpu (aka be32_to_cpu) for endian conversion.
This is a bit error-prone, but sparse is useful to detect endian
mismatch.

We need to use (fdt32_t *) instead of (u32 *) for a pointer of a
property value.  Otherwise sparse warns "cast to restricted __be32".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mmc/sdhci-cadence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c
index 4bd2623eaef9..f83c1d724108 100644
--- a/drivers/mmc/sdhci-cadence.c
+++ b/drivers/mmc/sdhci-cadence.c
@@ -92,7 +92,7 @@ static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_plat *plat,
 static int sdhci_cdns_phy_init(struct sdhci_cdns_plat *plat,
 				const void *fdt, int nodeoffset)
 {
-	const u32 *prop;
+	const fdt32_t *prop;
 	int ret, i;
 
 	for (i = 0; i < ARRAY_SIZE(sdhci_cdns_phy_cfgs); i++) {
-- 
2.7.4

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

* [U-Boot] [PATCH] mmc: cadence: use fdt32_t for DT property value to fix sparse warning
  2017-06-22  8:58 ` [U-Boot] [PATCH] mmc: cadence: use fdt32_t for DT property value to fix sparse warning Masahiro Yamada
@ 2017-06-29  9:46   ` Jaehoon Chung
  0 siblings, 0 replies; 2+ messages in thread
From: Jaehoon Chung @ 2017-06-29  9:46 UTC (permalink / raw)
  To: u-boot

On 06/22/2017 05:58 PM, Masahiro Yamada wrote:
> DTB is encoded in big endian.  When we retrieve property values,
> we need to use fdt32_to_cpu (aka be32_to_cpu) for endian conversion.
> This is a bit error-prone, but sparse is useful to detect endian
> mismatch.
> 
> We need to use (fdt32_t *) instead of (u32 *) for a pointer of a
> property value.  Otherwise sparse warns "cast to restricted __be32".
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

> ---
> 
>  drivers/mmc/sdhci-cadence.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c
> index 4bd2623eaef9..f83c1d724108 100644
> --- a/drivers/mmc/sdhci-cadence.c
> +++ b/drivers/mmc/sdhci-cadence.c
> @@ -92,7 +92,7 @@ static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_plat *plat,
>  static int sdhci_cdns_phy_init(struct sdhci_cdns_plat *plat,
>  				const void *fdt, int nodeoffset)
>  {
> -	const u32 *prop;
> +	const fdt32_t *prop;
>  	int ret, i;
>  
>  	for (i = 0; i < ARRAY_SIZE(sdhci_cdns_phy_cfgs); i++) {
> 

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

end of thread, other threads:[~2017-06-29  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170622085825epcas1p4caf275ab3ff7f091e1e981b81523d8f0@epcas1p4.samsung.com>
2017-06-22  8:58 ` [U-Boot] [PATCH] mmc: cadence: use fdt32_t for DT property value to fix sparse warning Masahiro Yamada
2017-06-29  9:46   ` Jaehoon Chung

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.