IB/cm: Handle address handle attribute init error
authorParav Pandit <parav@mellanox.com>
Tue, 14 Nov 2017 12:52:14 +0000 (14:52 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 18 Dec 2017 22:37:11 +0000 (15:37 -0700)
cm_init_av_by_path depends on ib_init_ah_from_path to initialize ah
attribute and ib_init_ah_from_path() can fail, such error should not
be ignored.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cm.c

index f9bb24c2679e4151be88e75e85fec1066a87fa37..c6a81667867552b1daa9da3f4257db63c56cd3be 100644 (file)
@@ -494,8 +494,11 @@ static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
                return ret;
 
        av->port = port;
-       ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
-                            &av->ah_attr);
+       ret = ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
+                                  &av->ah_attr);
+       if (ret)
+               return ret;
+
        av->timeout = path->packet_life_time + 1;
 
        spin_lock_irqsave(&cm.lock, flags);