Re: [PATCH 08/29] IB/mlx4: Delete an unnecessary check before the function call "kfree" in free_pv_object()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Feb 18, 2017, at 11:28 PM, SF Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> 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 <elfring@xxxxxxxxxxxxxxxxxxxxx>
> ---
> 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 majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux