KVM: s390: pci: fix plain integer as NULL pointer warnings
PATCH 1/1 KVM: s390: pci: fix plain integer as NULL pointer warnings
Fix some sparse warnings that a plain integer 0 is being used instead of NULL.
--- arch/s390/kvm/pci.c | 4 ++-- arch/s390/kvm/pci.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
arch/s390/kvm/pci.c +2 -2
@@ -58,7 +58,7 @@ static int zpci_setup_aipb(u8 nisc)if (!zpci_aipb)return -ENOMEM ; - aift->sbv =airq_iv_create (ZPCI_NR_DEVICES ,AIRQ_IV_ALLOC ,0 ); + aift->sbv =airq_iv_create (ZPCI_NR_DEVICES ,AIRQ_IV_ALLOC ,NULL );if (!aift->sbv) { rc = -ENOMEM ; goto free_aipb;
@@ -373,7 +373,7 @@ static int kvm_s390_pci_aif_disable(struct zpci_dev *zdev, bool force) gaite->gisc =0 ; gaite->aisbo =0 ; gaite->gisa =0 ; - aift->kzdev[zdev->aisb] =0 ; + aift->kzdev[zdev->aisb] =NULL ;/* Clear zdev info */ airq_iv_free_bit (aift->sbv, zdev->aisb);airq_iv_release (zdev->aibv);
arch/s390/kvm/pci.h +3 -3
@@ -46,9 +46,9 @@ extern struct zpci_aift *aift;static inline struct kvm *kvm_s390_pci_si_to_kvm (struct zpci_aift *aift,unsigned long si) { -if (!IS_ENABLED (CONFIG_VFIO_PCI_ZDEV_KVM ) || aift->kzdev ==0 || - aift->kzdev[si] ==0 ) -return 0 ; +if (!IS_ENABLED (CONFIG_VFIO_PCI_ZDEV_KVM ) || aift->kzdev ==NULL || + aift->kzdev[si] ==NULL ) +return NULL ;return aift->kzdev[si]->kvm; };
Signature · 1 line
2.31.1
Quoted 5 lines · Matthew Rosato
Fix some sparse warnings that a plain integer 0 is being used instead of NULL.
Reported-by kernel test robot <[email protected]>Signed-off-by Matthew Rosato <[email protected]>
@Janosch, since you are taking the other PCI fix can you also take this small cleanup through KVM?
Quoted 44 lines
--- arch/s390/kvm/pci.c | 4 ++-- arch/s390/kvm/pci.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)arch/s390/kvm/pci.c +2
-2@@ -58,7 +58,7 @@ static int zpci_setup_aipb(u8 nisc)if (!zpci_aipb)return -ENOMEM ; - aift->sbv =airq_iv_create (ZPCI_NR_DEVICES ,AIRQ_IV_ALLOC ,0 ); + aift->sbv =airq_iv_create (ZPCI_NR_DEVICES ,AIRQ_IV_ALLOC ,NULL );if (!aift->sbv) { rc = -ENOMEM ; goto free_aipb;@@ -373,7 +373,7 @@ static int kvm_s390_pci_aif_disable(struct zpci_dev *zdev, bool force) gaite->gisc =0 ; gaite->aisbo =0 ; gaite->gisa =0 ; - aift->kzdev[zdev->aisb] =0 ; + aift->kzdev[zdev->aisb] =NULL ;/* Clear zdev info */ airq_iv_free_bit (aift->sbv, zdev->aisb);airq_iv_release (zdev->aibv);arch/s390/kvm/pci.h +3
-3@@ -46,9 +46,9 @@ extern struct zpci_aift *aift;static inline struct kvm *kvm_s390_pci_si_to_kvm (struct zpci_aift *aift,unsigned long si) { -if (!IS_ENABLED (CONFIG_VFIO_PCI_ZDEV_KVM ) || aift->kzdev ==0 || - aift->kzdev[si] ==0 ) -return 0 ; +if (!IS_ENABLED (CONFIG_VFIO_PCI_ZDEV_KVM ) || aift->kzdev ==NULL || + aift->kzdev[si] ==NULL ) +return NULL ;return aift->kzdev[si]->kvm; };
Am 23.08.22 um 21:18 schrieb Matthew Rosato:
Quoted 8 lines · Matthew Rosato
Quoted 5 lines
Fix some sparse warnings that a plain integer 0 is being used instead of NULL.
Reported-by kernel test robot <[email protected]>Signed-off-by Matthew Rosato <[email protected]>@Janosch, since you are taking the other PCI fix can you also take this small cleanup through KVM?
Queued now for the kvm tree. Will have to look if we have other things for 6.0. Otherwise it will go with 6.1.
Quoted 46 lines
Quoted 45 lines
--- arch/s390/kvm/pci.c | 4 ++-- arch/s390/kvm/pci.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)arch/s390/kvm/pci.c +2
-2@@ -58,7 +58,7 @@ static int zpci_setup_aipb(u8 nisc)if (!zpci_aipb)return -ENOMEM ; - aift->sbv =airq_iv_create (ZPCI_NR_DEVICES ,AIRQ_IV_ALLOC ,0 ); + aift->sbv =airq_iv_create (ZPCI_NR_DEVICES ,AIRQ_IV_ALLOC ,NULL );if (!aift->sbv) { rc = -ENOMEM ; goto free_aipb;@@ -373,7 +373,7 @@ static int kvm_s390_pci_aif_disable(struct zpci_dev *zdev, bool force) gaite->gisc =0 ; gaite->aisbo =0 ; gaite->gisa =0 ; - aift->kzdev[zdev->aisb] =0 ; + aift->kzdev[zdev->aisb] =NULL ;/* Clear zdev info */ airq_iv_free_bit (aift->sbv, zdev->aisb);airq_iv_release (zdev->aibv);arch/s390/kvm/pci.h +3
-3@@ -46,9 +46,9 @@ extern struct zpci_aift *aift;static inline struct kvm *kvm_s390_pci_si_to_kvm (struct zpci_aift *aift,unsigned long si) { -if (!IS_ENABLED (CONFIG_VFIO_PCI_ZDEV_KVM ) || aift->kzdev ==0 || - aift->kzdev[si] ==0 ) -return 0 ; +if (!IS_ENABLED (CONFIG_VFIO_PCI_ZDEV_KVM ) || aift->kzdev ==NULL || + aift->kzdev[si] ==NULL ) +return NULL ;return aift->kzdev[si]->kvm; };
Christian Borntraeger
maintainerAm 15.09.22 um 18:16 schrieb Christian Borntraeger:
Quoted 11 lines
Am 23.08.22 um 21:18 schrieb Matthew Rosato:
Quoted 8 lines · Matthew Rosato
Quoted 5 lines
Fix some sparse warnings that a plain integer 0 is being used instead of NULL.
Reported-by kernel test robot <[email protected]>Signed-off-by Matthew Rosato <[email protected]>@Janosch, since you are taking the other PCI fix can you also take this small cleanup through KVM?
Queued now for the kvm tree. Will have to look if we have other things for 6.0. Otherwise it will go with 6.1.
Hmmm, checkpatch --strict has this:
CHECK: Comparison to NULL could be written "!aift->kzdev" #52: FILE: arch/s390/kvm/pci.h:49:
+ if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || aift->kzdev == NULL ||
CHECK: Comparison to NULL could be written "!aift->kzdev[si]" #53: FILE: arch/s390/kvm/pci.h:50:
+ aift->kzdev[si] == NULL)
total: 0 errors, 0 warnings, 2 checks, 28 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
Can you maybe redo this so that we avoid followup patches?