[PATCH 2/4] cpuidle: riscv-sbi: Use scoped device node handling to simplify error paths

Krzysztof Kozlowski krzysztof.kozlowski at linaro.org
Tue Aug 20 02:29:08 PDT 2024


On 19/08/2024 18:13, Jonathan Cameron wrote:
>>  
>>  	/* Parse SBI specific details from state DT nodes */
>>  	for (i = 1; i < state_count; i++) {
>> @@ -264,10 +262,8 @@ static int sbi_cpuidle_dt_init_states(struct device *dev,
>>  
>>  		pr_debug("sbi-state %#x index %d\n", states[i], i);
>>  	}
>> -	if (i != state_count) {
>> -		ret = -ENODEV;
>> -		goto fail;
>> -	}
>> +	if (i != state_count)
>> +		return -ENODEV;
>>  
>>  	/* Initialize optional data, used for the hierarchical topology. */
>>  	ret = sbi_dt_cpu_init_topology(drv, data, state_count, cpu);
> The handling of error ret from here doesn't free the node.
> 
> Bug or something subtle I'm missing?
> 
> If it's a bug, then fixes tag.

Yeah, indeed it is a fix.

Best regards,
Krzysztof




More information about the linux-riscv mailing list