IB/ipoib: Add child to parent list only if device initialized
authorValentine Fatiev <valentinef@mellanox.com>
Sun, 30 Jun 2019 13:48:41 +0000 (16:48 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 4 Jul 2019 17:20:54 +0000 (14:20 -0300)
commit91b01061fef9c57d2f5b712a6322ef51061f4efd
tree93e65463effdaeedfaf10f7b0efe0d9e1f58e3a5
parent50ba3c18a4e549ba6a5a4672dfb3eb30fcb7d570
IB/ipoib: Add child to parent list only if device initialized

Despite failure in ipoib_dev_init() we continue with initialization flow
and creation of child device. It causes to the situation where this child
device is added too early to parent device list.

Change the logic, so in case of failure we properly return error from
ipoib_dev_init() and add child only in success path.

Fixes: eaeb39842508 ("IB/ipoib: Move init code to ndo_init")
Signed-off-by: Valentine Fatiev <valentinef@mellanox.com>
Reviewed-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/ulp/ipoib/ipoib_main.c