> On Feb 18, 2017, at 11:28 PM, SF Markus Elfring 
> <[email protected]> wrote:
> 
> From: Markus Elfring <[email protected]>
> Date: Fri, 17 Feb 2017 22:06:24 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> WARNING: kfree(NULL) is safe and this check is probably not required
> 
> Thus fix the affected source code place.
> 
> Signed-off-by: Markus Elfring <[email protected]>
> ---
> drivers/infiniband/hw/mlx4/mad.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/mad.c 
> b/drivers/infiniband/hw/mlx4/mad.c
> index 75b6522b3a8f..9518b7244269 100644
> --- a/drivers/infiniband/hw/mlx4/mad.c
> +++ b/drivers/infiniband/hw/mlx4/mad.c
> @@ -1966,10 +1966,8 @@ static int alloc_pv_object(struct mlx4_ib_dev *dev, 
> int slave, int port,
> 
> static void free_pv_object(struct mlx4_ib_dev *dev, int slave, int port)
> {
> -    if (dev->sriov.demux[port - 1].tun[slave]) {
> -        kfree(dev->sriov.demux[port - 1].tun[slave]);
> -        dev->sriov.demux[port - 1].tun[slave] = NULL;
> -    }
> +    kfree(dev->sriov.demux[port - 1].tun[slave]);
> +    dev->sriov.demux[port - 1].tun[slave] = NULL;
> }
In case it was NULL, we will have a redundant assignment here.
I don't think this change is needed..
> 
> static int create_pv_resources(struct ib_device *ibdev, int slave, int port,
> -- 
> 2.11.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to