diff mbox series

IB/mlx4: Remove unneeded NULL check

Message ID 20181211102635.25208-1-yuval.shaia@oracle.com (mailing list archive)
State Accepted
Commit 2dd8e44cb4f3893f26ca29e9593450f289a0b48a
Delegated to: Jason Gunthorpe
Headers show
Series IB/mlx4: Remove unneeded NULL check | expand

Commit Message

Yuval Shaia Dec. 11, 2018, 10:26 a.m. UTC
NULL check for kfree is unnecessary, remove it.

Fixes: b42dde47 ("IB/mlx4: Rework special QP creation error path")
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/hw/mlx4/qp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Leon Romanovsky Dec. 11, 2018, 11:46 a.m. UTC | #1
On Tue, Dec 11, 2018 at 12:26:35PM +0200, Yuval Shaia wrote:
> NULL check for kfree is unnecessary, remove it.
>
> Fixes: b42dde47 ("IB/mlx4: Rework special QP creation error path")

It is wrong Fixes format
Fixes: b42dde478bca ....

> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>  drivers/infiniband/hw/mlx4/qp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
> index fd95699cae35..651d8594dc3f 100644
> --- a/drivers/infiniband/hw/mlx4/qp.c
> +++ b/drivers/infiniband/hw/mlx4/qp.c
> @@ -1211,10 +1211,10 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
>  		mlx4_db_free(dev->dev, &qp->db);
>
>  err:
> -	if (sqp)
> -		kfree(sqp);
> -	else if (!*caller_qp)
> +	if (!sqp && !*caller_qp)
>  		kfree(qp);
> +	kfree(sqp);
> +

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Jason Gunthorpe Dec. 11, 2018, 9:07 p.m. UTC | #2
On Tue, Dec 11, 2018 at 12:26:35PM +0200, Yuval Shaia wrote:
> NULL check for kfree is unnecessary, remove it.
> 
> Fixes: b42dde47 ("IB/mlx4: Rework special QP creation error path")
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx4/qp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied to for-next

Thanks,
Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index fd95699cae35..651d8594dc3f 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1211,10 +1211,10 @@  static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
 		mlx4_db_free(dev->dev, &qp->db);
 
 err:
-	if (sqp)
-		kfree(sqp);
-	else if (!*caller_qp)
+	if (!sqp && !*caller_qp)
 		kfree(qp);
+	kfree(sqp);
+
 	return err;
 }