If sdp fails to initialize at driver startup for any reason,
the device is still registered with the ib_core, but there will be
no client data (i.e., ib_set_client_data() will not be called, and all
kernel resources are de-allocated).
On removal, ib_get_client_data() will return NULL in this case -- and this
must be tested for -- or we will get a kernel Oops for a NULL pointer
dereference.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
write_unlock(&device_removal_lock);
sdp_dev = ib_get_client_data(device, &sdp_client);
+ if (!sdp_dev)
+ return;
ib_flush_fmr_pool(sdp_dev->fmr_pool);
ib_destroy_fmr_pool(sdp_dev->fmr_pool);