From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Subject: Re: KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection Date: Sat, 27 Aug 2016 18:12:33 +0200 Message-ID: <05fa56cb-843e-39bd-847d-1b31b5a726b5@users.sourceforge.net> References: <82b84c9c-38a4-4d17-910f-312668dbae01@users.sourceforge.net> <47f88a11-b949-28ed-5589-925888a37574@users.sourceforge.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Archive: List-Post: To: =?UTF-8?Q?Christian_Borntr=c3=a4ger?= Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand , Heiko Carstens , Martin Schwidefsky , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , LKML , kernel-janitors@vger.kernel.org, Julia Lawall List-ID: >> @@ -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