diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 631eaa9daf65..a5dfab6adf49 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -376,7 +376,8 @@ static void ib_policy_change_task(struct work_struct *work) WARN_ONCE(ret, "ib_get_cached_subnet_prefix err: %d, this should never happen here\n", ret); - ib_security_cache_change(dev, i, sp); + if (!ret) + ib_security_cache_change(dev, i, sp); } } up_read(&lists_rwsem);