diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2020-03-27 21:35:39 -0500 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2020-03-29 11:09:55 -0300 |
commit | d35dc58dd26e2aef5dd7ed1929179c9974f8bb97 (patch) | |
tree | 13cada42c0721c3d6bdc63d13c649b092129d651 /drivers/infiniband/hw/hns | |
parent | 90e735aecc4ce94eb4a2838f9fe04ee8da70b529 (diff) | |
download | linux-d35dc58dd26e2aef5dd7ed1929179c9974f8bb97.tar.gz linux-d35dc58dd26e2aef5dd7ed1929179c9974f8bb97.tar.bz2 linux-d35dc58dd26e2aef5dd7ed1929179c9974f8bb97.zip |
RDMA/hns: Fix uninitialized variable bug
There is a potential execution path in which variable *ret* is returned
without being properly initialized, previously.
Fix this by initializing variable *ret* to 0.
Link: https://lore.kernel.org/r/20200328023539.GA32016@embeddedor
Addresses-Coverity-ID: 1491917 ("Uninitialized scalar variable")
Fixes: 2f49de21f3e9 ("RDMA/hns: Optimize mhop get flow for multi-hop addressing")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/hns')
-rw-r--r-- | drivers/infiniband/hw/hns/hns_roce_hem.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c index c96378718f88..263338b90d7a 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hem.c +++ b/drivers/infiniband/hw/hns/hns_roce_hem.c @@ -603,7 +603,7 @@ static int set_mhop_hem(struct hns_roce_dev *hr_dev, { struct ib_device *ibdev = &hr_dev->ib_dev; int step_idx; - int ret; + int ret = 0; if (index->inited & HEM_INDEX_L0) { ret = hr_dev->hw->set_hem(hr_dev, table, obj, 0); |