KVM: s390: add functions to (un)register GISC with GISA
Quoted 46 lines · On Mon, 10 Dec 2018 15:37:47 +0100 Pierre Morel <[email protected]> wrote:
Quoted 33 lines · Michael Mueller
Quoted 30 lines · Cornelia Huck
Quoted 19 lines · On Mon, 10 Dec 2018 10:27:54 +0100 Pierre Morel <[email protected]> wrote:
Quoted 18 lines · Michael Mueller
Quoted 15 lines · Cornelia Huck
Review
Quoted 12 lines · On Fri, 30 Nov 2018 15:32:13 +0100 Michael Mueller <[email protected]> wrote:
(quoted diff) +12
-0+int kvm_s390_gisc_unregister(struct kvm *kvm, u32 gisc) +{ +��� int rc = 0; + +��� if (!kvm->arch.gib_in_use) +������� return -ENODEV; +��� if (gisc > MAX_ISC) +������� return -EINVAL; + +��� spin_lock(&kvm->arch.iam_ref_lock); +��� if (kvm->arch.iam_ref_count[gisc] == 0) { +������� rc = -EFAULT;
-EFAULTlooks odd.-EINVAL?Quoted 4 lines
Quoted 1 line
sure
Can we find some errno return value which is not already used in this function?
I'm not sure what would be a better fit here (
-EINVALif you try to unregister something that has never been registered seems reasonable).Quoted 11 lines
Quoted 5 lines
Also, I think it is quite reasonable if a function returns the same error for different reasons, as long as they are all the same class of error. In this case, both the caller using an out-of-rage gisc or a gisc that has never been registered indicate some internal mixup in how the caller handles the gisc.
I think
-EPERMis the right choice here. It is not permitted to decrease the ref counter below zero.Quoted 1 line
To be anoying I would prefer
Review
Quoted 3 lines
(quoted diff) +0
-2-ERANGE if gisc > MAX_ISC -EINVAL in the second case is OK for me
If you want different return codes, this one makes more sense to me.
Quoted 4 lines
and I also can agree with the argumentation of Conny.