Skip to contentSkip to conversation

vfio/mlx5: Fix to not use 0 as NULL pointer

PATCH Applied Yishai Hadas 2 participants 2 messages Mar 9, 2022

Subsystems (4)
lore
Share & tools
lore

Yishai Hadas

author maintainer
#0 lore raw

PATCH 1/1 vfio/mlx5: Fix to not use 0 as NULL pointer

Fix sparse warning to not use plain integer (i.e. 0) as NULL pointer.

Fixes 6fadb021266d ("vfio/mlx5: Implement vfio_pci driver for mlx5 devices")
---
 drivers/vfio/pci/mlx5/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vfio/pci/mlx5/main.c +2 -2
index 282a9d4bf776..bbec5d288fee 100644
@@ -409,7 +409,7 @@ mlx5vf_pci_step_device_state_locked(struct mlx5vf_pci_core_device *mvdev,
 
 	if ((cur == VFIO_DEVICE_STATE_STOP_COPY && new == VFIO_DEVICE_STATE_STOP)) {
 		mlx5vf_disable_fds(mvdev);
-		return 0;
+		return NULL;
 	}
 
 	if (cur == VFIO_DEVICE_STATE_STOP && new == VFIO_DEVICE_STATE_RESUMING) {
@@ -430,7 +430,7 @@ mlx5vf_pci_step_device_state_locked(struct mlx5vf_pci_core_device *mvdev,
 		if (ret)
 			return ERR_PTR(ret);
 		mlx5vf_disable_fds(mvdev);
-		return 0;
+		return NULL;
 	}
 
 	/*
Signature · 1 line
2.18.1
#1 lore raw
Quoted 23 lines · On Wed, 9 Mar 2022 10:02:17 +0200 Yishai Hadas <[email protected]> wrote:

Fix sparse warning to not use plain integer (i.e. 0) as NULL pointer.

Fixes 6fadb021266d ("vfio/mlx5: Implement vfio_pci driver for mlx5 devices")
---
 drivers/vfio/pci/mlx5/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vfio/pci/mlx5/main.c +1 -1
index 282a9d4bf776..bbec5d288fee 100644
@@ -409,7 +409,7 @@ mlx5vf_pci_step_device_state_locked(struct mlx5vf_pci_core_device *mvdev,
 
 	if ((cur == VFIO_DEVICE_STATE_STOP_COPY && new == VFIO_DEVICE_STATE_STOP)) {
 		mlx5vf_disable_fds(mvdev);
-		return 0;
+		return NULL;
 	}
 
 	if (cur == VFIO_DEVICE_STATE_STOP && new == VFIO_DEVICE_STATE_RESUMING) {

drivers/vfio/pci/mlx5/main.c mlx5vf_pci_step_device_state_locked(struct mlx5vf_pci_core_device *mvdev, · line 436

Quoted 8 lines
drivers/vfio/pci/mlx5/main.c +1 -1
@@ -430,7 +430,7 @@ mlx5vf_pci_step_device_state_locked(struct mlx5vf_pci_core_device *mvdev,
 		if (ret)
 			return ERR_PTR(ret);
 		mlx5vf_disable_fds(mvdev);
-		return 0;
+		return NULL;
 	}
 
 	/*

Applied to vfio next branch for v5.18. Thanks,

Alex