Re: KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection
From: SF Markus Elfring
Date: Sat Aug 27 2016 - 12:13:19 EST
>> @@ -273,10 +273,12 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
>> vcpu->arch.guestdbg.nr_hw_wp = nr_wp;
>> vcpu->arch.guestdbg.hw_wp_info = wp_info;
>> return 0;
>> -error:
>> - kfree(bp_data);
>> - kfree(wp_info);
>> +free_bp_info:
>> kfree(bp_info);
>> +free_wp_info:
>> + kfree(wp_info);
>> +free_bp_data:
>> + kfree(bp_data);
>> return ret;
>> }
>
> I agree with Cornelia,
This is generally fine.
> while it seems correct from a technical point of view,
Thanks for another bit of acknowledgement.
> it will make the code harder to maintain.
I agree that there some efforts and challenges involved.
> For example if we ever add a new malloc and remove another one
Do you see any changes coming from this direction?
> over time we would need to reshuffle the labels
This can occasionally happen, can't it?
> and this did went wrong several times in the past.
Would you like to add any corresponding software development experiences
to discussions around a topic like "CodingStyle: add some more error
handling guidelines"?
https://www.spinics.net/lists/linux-doc/msg39307.html
http://marc.info/?l=linux-doc&m=147187538413914
Regards,
Markus