[PATCH v2 2/4] boot: fdt: Clean up env_get_bootm_size()

Marek Vasut marek.vasut at mailbox.org
Wed Mar 20 21:52:34 CET 2024


On 3/18/24 5:18 PM, Laurent Pinchart wrote:

>> @@ -142,7 +140,7 @@ phys_size_t env_get_bootm_size(void)
>>   
>>   	s = env_get("bootm_low");
>>   	if (s)
>> -		tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
>> +		tmp = simple_strtoull(s, NULL, 16);
>>   	else
>>   		tmp = start;
>>   
> 
> Maybe you could even drop the tmp variable completely by writing this
> 
> 	if (s)
> 		size -= simple_strtoull(s, NULL, 16) - start;
> 
> 	return size;
> 
> I've never liked variables named tmp :-)

No, let's not do this. With this FDT part, the code should be verbose 
and as easy to understand at first glance as possible, no subtraction 
assignments and other shenanigans please.


More information about the U-Boot mailing list