On 10/24/17 3:22 AM, Jiri Pirko wrote: > @@ -980,7 +998,7 @@ static const struct devlink_ops mlxsw_devlink_ops = { > > int mlxsw_core_bus_device_register(const struct mlxsw_bus_info > *mlxsw_bus_info, > const struct mlxsw_bus *mlxsw_bus, > - void *bus_priv) > + void *bus_priv, bool reload) > { > const char *device_kind = mlxsw_bus_info->device_kind; > struct mlxsw_core *mlxsw_core; > @@ -992,11 +1010,14 @@ int mlxsw_core_bus_device_register(const struct > mlxsw_bus_info *mlxsw_bus_info, > mlxsw_driver = mlxsw_core_driver_get(device_kind); > if (!mlxsw_driver) > return -EINVAL; > - alloc_size = sizeof(*mlxsw_core) + mlxsw_driver->priv_size; > - devlink = devlink_alloc(&mlxsw_devlink_ops, alloc_size); > - if (!devlink) { > - err = -ENOMEM; > - goto err_devlink_alloc; > + > + if (!reload) { > + alloc_size = sizeof(*mlxsw_core) + mlxsw_driver->priv_size; > + devlink = devlink_alloc(&mlxsw_devlink_ops, alloc_size); > + if (!devlink) { > + err = -ENOMEM; > + goto err_devlink_alloc; > + } > } > > mlxsw_core = devlink_priv(devlink);
devlink is not set if reload is true, yet is used in the line above.