]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mmc: fix data type of timer variables
authorLothar Waßmann <LW@KARO-electronics.de>
Mon, 13 Mar 2017 10:19:51 +0000 (11:19 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Mon, 13 Mar 2017 15:36:34 +0000 (16:36 +0100)
get_timer() returns an unsigned long value. This may be 64bit wide on
64bit archs. Storing this value in an unsigned int will cut off the
upper half of the value leading to miscalculation of the elapsed time,
if the upper 32bits of the current timestamp are non-zero.

drivers/mmc/mmc.c
drivers/mmc/sdhci.c

index a7a5134529eb5d0f5e003671567d5ce0f942616f..c8fd3346d3f933c103af69d5558dd1660e7c186a 100644 (file)
@@ -435,7 +435,7 @@ static int mmc_complete_op_cond(struct mmc *mmc)
 {
        struct mmc_cmd cmd;
        int timeout = 10 * CONFIG_SYS_HZ;
-       uint start;
+       unsigned long start;
        int err;
 
        mmc->op_cond_pending = 0;
@@ -1684,7 +1684,7 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
        int err = 0;
-       unsigned start;
+       unsigned long start;
 #ifdef CONFIG_DM_MMC
        struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc->dev);
 
index ad72e97f84773d4a7c8f2bf7a28e374dc69d51fa..2ad6e80645af8805a892ebc88ec1dab4cd5bffd5 100644 (file)
@@ -145,7 +145,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
        u32 mask, flags, mode;
        unsigned int time = 0, start_addr = 0;
        int mmc_dev = mmc_get_blk_desc(mmc)->devnum;
-       unsigned start = get_timer(0);
+       unsigned long start = get_timer(0);
 
        /* Timeout unit - ms */
        unsigned int cmd_timeout;