]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
sunxi: Explicitly cast u32 pointer conversions
authorAlexander Graf <agraf@suse.de>
Tue, 29 Mar 2016 15:29:09 +0000 (17:29 +0200)
committerHans de Goede <hdegoede@redhat.com>
Fri, 1 Apr 2016 07:52:28 +0000 (09:52 +0200)
Some parts of the sunxi code cast explicitly between u32 values and pointers.
This is not a problem in practice, because all 64bit SoCs today only use the
lower 32 bits for their phyical address space. But we need to make sure that
the compiler is sure this is not an accident as well.

Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/mach-sunxi/cpu_info.c
arch/arm/mach-sunxi/dram_helpers.c
arch/arm/mach-sunxi/usb_phy.c
drivers/mmc/sunxi_mmc.c

index c0eabdf91d353648c109f0edf64bf822369fe3df..b885ea1f0a01cf0cb9e69896b5bc9c7c4f5573cd 100644 (file)
@@ -105,7 +105,7 @@ int sunxi_get_sid(unsigned int *sid)
        int i;
 
        for (i = 0; i< 4; i++)
-               sid[i] = readl(SUNXI_SID_BASE + 4 * i);
+               sid[i] = readl((ulong)SUNXI_SID_BASE + 4 * i);
 
        return 0;
 #else
index 9a94e1b6795ed7d131d9d7382af4cf676be8fce7..50318d2eb6b1e4dd9121391ca9fde6fed4a6388a 100644 (file)
@@ -30,8 +30,8 @@ bool mctl_mem_matches(u32 offset)
 {
        /* Try to write different values to RAM at two addresses */
        writel(0, CONFIG_SYS_SDRAM_BASE);
-       writel(0xaa55aa55, CONFIG_SYS_SDRAM_BASE + offset);
+       writel(0xaa55aa55, (ulong)CONFIG_SYS_SDRAM_BASE + offset);
        /* Check if the same value is actually observed when reading back */
        return readl(CONFIG_SYS_SDRAM_BASE) ==
-              readl(CONFIG_SYS_SDRAM_BASE + offset);
+              readl((ulong)CONFIG_SYS_SDRAM_BASE + offset);
 }
index fa375f1d16de1a44e927e4f76cd19a876171c55f..b258ce4443cb5eaa98fe0d5bbd385795cee60497 100644 (file)
@@ -52,7 +52,7 @@ static struct sunxi_usb_phy {
        int id;
        int init_count;
        int power_on_count;
-       int base;
+       ulong base;
 } sunxi_usb_phy[] = {
        {
                .usb_rst_mask = CCM_USB_CTRL_PHY0_RST | CCM_USB_CTRL_PHY0_CLK,
index 7b33094d8486d0650f6328039254eca258d20121..44d1a768c183148e9c93b859fe6225d37bb17f89 100644 (file)
@@ -339,7 +339,7 @@ static int sunxi_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
                cmdval |= SUNXI_MMC_CMD_CHK_RESPONSE_CRC;
 
        if (data) {
-               if ((u32) data->dest & 0x3) {
+               if ((u32)(long)data->dest & 0x3) {
                        error = -1;
                        goto out;
                }