[U-Boot] [PATCH 1/2] env_mmc: remove condition on call to mmc_switch_part

Stephen Warren swarren at wwwdotorg.org
Wed Sep 3 17:46:25 CEST 2014


On 09/02/2014 05:31 PM, Peter A. Bigot wrote:
> Though it might be expected to do so, mmc_switch_part() does not change
> the part_num field of the device on which the partition has been
> changed.  As such, checking to see whether the partition is already the
> target partition will fail to correctly restore the original
> configuration in cases like env_mmc which rely on this behavior to
> avoid having to preserve the pre-switch partition number outside the
> device structure.

> diff --git a/common/env_mmc.c b/common/env_mmc.c

> -	if (part != mmc->part_num) {
> -		ret = mmc_switch_part(dev, part);
> -		if (ret)
> -			puts("MMC partition switch failed\n");
> -	}
> +	ret = mmc_switch_part(dev, part);
> +	if (ret)
> +		puts("MMC partition switch failed\n");

I'm not sure this is correct, but it might be.

I believe the if() is present to avoid any attempt to call 
mmc_switch_part() on a device that doesn't have HW partitions (in which 
case, both part and mmc->part_num should already be 0), since such an 
attempt might print an error message. If you don't observe any error 
message printed after this change, then perhaps this patch is fine.


More information about the U-Boot mailing list