* [PATCH 1/3] vdpa/mlx5: remove unnecessary null check
2022-06-22 18:51 [PATCH 0/3] more null pointer check removal Stephen Hemminger
@ 2022-06-22 18:51 ` Stephen Hemminger
2022-06-23 9:13 ` Matan Azrad
2022-06-22 18:51 ` [PATCH 2/3] raw/ifpga: " Stephen Hemminger
` (4 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2022-06-22 18:51 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Matan Azrad, Viacheslav Ovsiienko
Found by nullfree.cocci.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index e025be47d277..e06d6afb676f 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -285,8 +285,7 @@ mlx5_vdpa_virtq_setup(struct mlx5_vdpa_priv *priv, int index)
if (virtq->umems[i].obj)
claim_zero(mlx5_glue->devx_umem_dereg
(virtq->umems[i].obj));
- if (virtq->umems[i].buf)
- rte_free(virtq->umems[i].buf);
+ rte_free(virtq->umems[i].buf);
virtq->umems[i].size = 0;
virtq->umems[i].obj = NULL;
virtq->umems[i].buf = NULL;
--
2.35.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] raw/ifpga: remove unnecessary null check
2022-06-22 18:51 [PATCH 0/3] more null pointer check removal Stephen Hemminger
2022-06-22 18:51 ` [PATCH 1/3] vdpa/mlx5: remove unnecessary null check Stephen Hemminger
@ 2022-06-22 18:51 ` Stephen Hemminger
2022-06-22 18:51 ` [PATCH 3/3] dmap/dpaa2: " Stephen Hemminger
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2022-06-22 18:51 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Rosen Xu, Tianfei zhang
The function rte_kvargs_free handles calling with NULL.
Found by nullfree.cocci.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/raw/ifpga/ifpga_rawdev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index ceb18aed8d44..8c05302a65b8 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1768,8 +1768,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs,
ret = 0;
end:
- if (kvlist)
- rte_kvargs_free(kvlist);
+ rte_kvargs_free(kvlist);
return ret;
}
--
2.35.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] dmap/dpaa2: remove unnecessary null check
2022-06-22 18:51 [PATCH 0/3] more null pointer check removal Stephen Hemminger
2022-06-22 18:51 ` [PATCH 1/3] vdpa/mlx5: remove unnecessary null check Stephen Hemminger
2022-06-22 18:51 ` [PATCH 2/3] raw/ifpga: " Stephen Hemminger
@ 2022-06-22 18:51 ` Stephen Hemminger
2022-06-22 19:05 ` [PATCH 0/3] more null pointer check removal Tyler Retzlaff
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2022-06-22 18:51 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Gagandeep Singh, Hemant Agrawal
The function rte_free already handles being called with NULL.
Found by nullfree.cocci.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/dma/dpaa2/dpaa2_qdma.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c
index a93a60565df7..0500e8c22590 100644
--- a/drivers/dma/dpaa2/dpaa2_qdma.c
+++ b/drivers/dma/dpaa2/dpaa2_qdma.c
@@ -1404,11 +1404,9 @@ dpaa2_qdma_reset(struct rte_dma_dev *dev)
/* Reset and free virtual queues */
for (i = 0; i < qdma_dev->num_vqs; i++) {
- if (qdma_dev->vqs[i].status_ring)
- rte_ring_free(qdma_dev->vqs[i].status_ring);
+ rte_ring_free(qdma_dev->vqs[i].status_ring);
}
- if (qdma_dev->vqs)
- rte_free(qdma_dev->vqs);
+ rte_free(qdma_dev->vqs);
qdma_dev->vqs = NULL;
/* Reset QDMA device structure */
--
2.35.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] more null pointer check removal
2022-06-22 18:51 [PATCH 0/3] more null pointer check removal Stephen Hemminger
` (2 preceding siblings ...)
2022-06-22 18:51 ` [PATCH 3/3] dmap/dpaa2: " Stephen Hemminger
@ 2022-06-22 19:05 ` Tyler Retzlaff
2022-06-23 0:43 ` fengchengwen
2022-06-24 12:39 ` David Marchand
5 siblings, 0 replies; 8+ messages in thread
From: Tyler Retzlaff @ 2022-06-22 19:05 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Wed, Jun 22, 2022 at 11:51:55AM -0700, Stephen Hemminger wrote:
> Reran the Cocci script to check for unnecessary null
> pointer comparisons before free related functions.
>
> Stephen Hemminger (3):
> vdpa/mlx5: remove unnecessary null check
> raw/ifpga: remove unnecessary null check
> dmap/dpaa2: remove unnecessary null check
>
> drivers/dma/dpaa2/dpaa2_qdma.c | 6 ++----
> drivers/raw/ifpga/ifpga_rawdev.c | 3 +--
> drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 3 +--
> 3 files changed, 4 insertions(+), 8 deletions(-)
>
> --
Series-acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] more null pointer check removal
2022-06-22 18:51 [PATCH 0/3] more null pointer check removal Stephen Hemminger
` (3 preceding siblings ...)
2022-06-22 19:05 ` [PATCH 0/3] more null pointer check removal Tyler Retzlaff
@ 2022-06-23 0:43 ` fengchengwen
2022-06-24 12:39 ` David Marchand
5 siblings, 0 replies; 8+ messages in thread
From: fengchengwen @ 2022-06-23 0:43 UTC (permalink / raw)
To: Stephen Hemminger, dev
Series-reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
On 2022/6/23 2:51, Stephen Hemminger wrote:
> Reran the Cocci script to check for unnecessary null
> pointer comparisons before free related functions.
>
> Stephen Hemminger (3):
> vdpa/mlx5: remove unnecessary null check
> raw/ifpga: remove unnecessary null check
> dmap/dpaa2: remove unnecessary null check
>
> drivers/dma/dpaa2/dpaa2_qdma.c | 6 ++----
> drivers/raw/ifpga/ifpga_rawdev.c | 3 +--
> drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 3 +--
> 3 files changed, 4 insertions(+), 8 deletions(-)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] more null pointer check removal
2022-06-22 18:51 [PATCH 0/3] more null pointer check removal Stephen Hemminger
` (4 preceding siblings ...)
2022-06-23 0:43 ` fengchengwen
@ 2022-06-24 12:39 ` David Marchand
5 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2022-06-24 12:39 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Wed, Jun 22, 2022 at 8:52 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Reran the Cocci script to check for unnecessary null
> pointer comparisons before free related functions.
Applied with series
https://patchwork.dpdk.org/project/dpdk/list/?series=21752&state=*
--
David Marchand
^ permalink raw reply [flat|nested] 8+ messages in thread