From: Thomas Huth Date: Mon, 23 Jan 2017 19:22:12 +0000 Subject: Re: [PATCH 05/11] KVM: PPC: Book3S HV: Adjust nine checks for null pointers Message-Id: <5d8a5f7f-be7a-265c-855d-7cb4fae9019e@redhat.com> List-Id: References: <161c8660-d204-5190-9bda-c5a801abe0ab@users.sourceforge.net> In-Reply-To: <161c8660-d204-5190-9bda-c5a801abe0ab@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: SF Markus Elfring , kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Alexander Graf , Benjamin Herrenschmidt , Michael Ellerman , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Cc: LKML , kernel-janitors@vger.kernel.org On 20.01.2017 19:23, SF Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 20 Jan 2017 11:25:48 +0100 > MIME-Version: 1.0 > Content-Type: text/plain; charset=3DUTF-8 > Content-Transfer-Encoding: 8bit >=20 > The script "checkpatch.pl" pointed information out like the following. >=20 > Comparison to NULL could be written =E2=80=A6 That's maybe ok for new code / if the code has to be touched anyway ... but for existing code, this sounds very much like unnecessary code-churn to me (e.g. it hides more important information with "git blame"). Thomas >=20 > Signed-off-by: Markus Elfring > --- > arch/powerpc/kvm/book3s_hv.c | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) >=20 > diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c > index cfc7699d05df..3122998f6a32 100644 > --- a/arch/powerpc/kvm/book3s_hv.c > +++ b/arch/powerpc/kvm/book3s_hv.c > @@ -458,7 +458,7 @@ static unsigned long do_h_register_vpa(struct kvm_vcp= u *vcpu, > =20 > /* convert logical addr to kernel addr and read length */ > va =3D kvmppc_pin_guest_page(kvm, vpa, &nb); > - if (va =3D NULL) > + if (!va) > return H_PARAMETER; > if (subfunc =3D H_VPA_REG_VPA) > len =3D be16_to_cpu(((struct reg_vpa *)va)->length.hword); > @@ -1591,8 +1591,7 @@ static struct kvmppc_vcore *kvmppc_vcore_create(str= uct kvm *kvm, int core) > struct kvmppc_vcore *vcore; > =20 > vcore =3D kzalloc(sizeof(struct kvmppc_vcore), GFP_KERNEL); > - > - if (vcore =3D NULL) > + if (!vcore) > return NULL; > =20 > spin_lock_init(&vcore->lock); > @@ -2221,7 +2220,7 @@ static void collect_piggybacks(struct core_info *ci= p, int target_threads) > prepare_threads(pvc); > if (!pvc->n_runnable) { > list_del_init(&pvc->preempt_list); > - if (pvc->runner =3D NULL) { > + if (!pvc->runner) { > pvc->vcore_state =3D VCORE_INACTIVE; > kvmppc_core_end_stolen(pvc); > } > @@ -2287,7 +2286,7 @@ static void post_guest_process(struct kvmppc_vcore = *vc, bool is_master) > } else { > vc->vcore_state =3D VCORE_INACTIVE; > } > - if (vc->n_runnable > 0 && vc->runner =3D NULL) { > + if (vc->n_runnable > 0 && !vc->runner) { > /* make sure there's a candidate runner awake */ > i =3D -1; > vcpu =3D next_runnable_thread(vc, &i); > @@ -2786,7 +2785,7 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run,= struct kvm_vcpu *vcpu) > =20 > while (vcpu->arch.state =3D KVMPPC_VCPU_RUNNABLE && > !signal_pending(current)) { > - if (vc->vcore_state =3D VCORE_PREEMPT && vc->runner =3D NULL) > + if (vc->vcore_state =3D VCORE_PREEMPT && !vc->runner) > kvmppc_vcore_end_preempt(vc); > =20 > if (vc->vcore_state !=3D VCORE_INACTIVE) { > @@ -2833,7 +2832,7 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run,= struct kvm_vcpu *vcpu) > vc->vcore_state =3D VCORE_PIGGYBACK)) > kvmppc_wait_for_exec(vc, vcpu, TASK_UNINTERRUPTIBLE); > =20 > - if (vc->vcore_state =3D VCORE_PREEMPT && vc->runner =3D NULL) > + if (vc->vcore_state =3D VCORE_PREEMPT && !vc->runner) > kvmppc_vcore_end_preempt(vc); > =20 > if (vcpu->arch.state =3D KVMPPC_VCPU_RUNNABLE) { > @@ -3203,7 +3202,7 @@ void kvmppc_alloc_host_rm_ops(void) > int size; > =20 > /* Not the first time here ? */ > - if (kvmppc_host_rm_ops_hv !=3D NULL) > + if (kvmppc_host_rm_ops_hv) > return; > =20 > ops =3D kzalloc(sizeof(struct kvmppc_host_rm_ops), GFP_KERNEL); > @@ -3430,10 +3429,10 @@ static int kvmppc_set_passthru_irq(struct kvm *kv= m, int host_irq, int guest_gsi) > mutex_lock(&kvm->lock); > =20 > pimap =3D kvm->arch.pimap; > - if (pimap =3D NULL) { > + if (!pimap) { > /* First call, allocate structure to hold IRQ map */ > pimap =3D kvmppc_alloc_pimap(); > - if (pimap =3D NULL) { > + if (!pimap) { > mutex_unlock(&kvm->lock); > return -ENOMEM; > } >=20 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html