kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: s390: pci: fix plain integer as NULL pointer warnings
@ 2022-08-23 19:15 Matthew Rosato
  2022-08-23 19:18 ` Matthew Rosato
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Rosato @ 2022-08-23 19:15 UTC (permalink / raw)
  To: linux-s390
  Cc: farman, schnelle, pmorel, borntraeger, frankja, imbrenda, david,
	hca, gor, gerald.schaefer, agordeev, svens, kvm, linux-kernel,
	kernel test robot

Fix some sparse warnings that a plain integer 0 is being used instead of
NULL.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
 arch/s390/kvm/pci.c | 4 ++--
 arch/s390/kvm/pci.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
index bb8c335d17b9..3c12637ce08c 100644
--- a/arch/s390/kvm/pci.c
+++ b/arch/s390/kvm/pci.c
@@ -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);
diff --git a/arch/s390/kvm/pci.h b/arch/s390/kvm/pci.h
index 3a3606c3a0fe..7be5568d8bd2 100644
--- a/arch/s390/kvm/pci.h
+++ b/arch/s390/kvm/pci.h
@@ -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;
 };
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: s390: pci: fix plain integer as NULL pointer warnings
  2022-08-23 19:15 [PATCH] KVM: s390: pci: fix plain integer as NULL pointer warnings Matthew Rosato
@ 2022-08-23 19:18 ` Matthew Rosato
  2022-09-15 16:16   ` Christian Borntraeger
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Rosato @ 2022-08-23 19:18 UTC (permalink / raw)
  To: linux-s390, frankja
  Cc: farman, schnelle, pmorel, borntraeger, imbrenda, david, hca, gor,
	gerald.schaefer, agordeev, svens, kvm, linux-kernel,
	kernel test robot

On 8/23/22 3:15 PM, Matthew Rosato wrote:
> Fix some sparse warnings that a plain integer 0 is being used instead of
> NULL.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>

@Janosch, since you are taking the other PCI fix can you also take this small cleanup through KVM?

> ---
>  arch/s390/kvm/pci.c | 4 ++--
>  arch/s390/kvm/pci.h | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
> index bb8c335d17b9..3c12637ce08c 100644
> --- a/arch/s390/kvm/pci.c
> +++ b/arch/s390/kvm/pci.c
> @@ -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);
> diff --git a/arch/s390/kvm/pci.h b/arch/s390/kvm/pci.h
> index 3a3606c3a0fe..7be5568d8bd2 100644
> --- a/arch/s390/kvm/pci.h
> +++ b/arch/s390/kvm/pci.h
> @@ -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;
>  };
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: s390: pci: fix plain integer as NULL pointer warnings
  2022-08-23 19:18 ` Matthew Rosato
@ 2022-09-15 16:16   ` Christian Borntraeger
  2022-09-15 16:28     ` Christian Borntraeger
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2022-09-15 16:16 UTC (permalink / raw)
  To: Matthew Rosato, linux-s390, frankja
  Cc: farman, schnelle, pmorel, imbrenda, david, hca, gor,
	gerald.schaefer, agordeev, svens, kvm, linux-kernel,
	kernel test robot

Am 23.08.22 um 21:18 schrieb Matthew Rosato:
> On 8/23/22 3:15 PM, Matthew Rosato wrote:
>> Fix some sparse warnings that a plain integer 0 is being used instead of
>> NULL.
>>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> 
> @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.

> 
>> ---
>>   arch/s390/kvm/pci.c | 4 ++--
>>   arch/s390/kvm/pci.h | 6 +++---
>>   2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
>> index bb8c335d17b9..3c12637ce08c 100644
>> --- a/arch/s390/kvm/pci.c
>> +++ b/arch/s390/kvm/pci.c
>> @@ -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);
>> diff --git a/arch/s390/kvm/pci.h b/arch/s390/kvm/pci.h
>> index 3a3606c3a0fe..7be5568d8bd2 100644
>> --- a/arch/s390/kvm/pci.h
>> +++ b/arch/s390/kvm/pci.h
>> @@ -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;
>>   };
>>   
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: s390: pci: fix plain integer as NULL pointer warnings
  2022-09-15 16:16   ` Christian Borntraeger
@ 2022-09-15 16:28     ` Christian Borntraeger
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2022-09-15 16:28 UTC (permalink / raw)
  To: Matthew Rosato, linux-s390, frankja
  Cc: farman, schnelle, pmorel, imbrenda, david, hca, gor,
	gerald.schaefer, agordeev, svens, kvm, linux-kernel,
	kernel test robot



Am 15.09.22 um 18:16 schrieb Christian Borntraeger:
> Am 23.08.22 um 21:18 schrieb Matthew Rosato:
>> On 8/23/22 3:15 PM, Matthew Rosato wrote:
>>> Fix some sparse warnings that a plain integer 0 is being used instead of
>>> NULL.
>>>
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
>>
>> @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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-15 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 19:15 [PATCH] KVM: s390: pci: fix plain integer as NULL pointer warnings Matthew Rosato
2022-08-23 19:18 ` Matthew Rosato
2022-09-15 16:16   ` Christian Borntraeger
2022-09-15 16:28     ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).