Commit 3f716a62 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

devlink: put couple of WARN_ONs in devlink_param_driverinit_value_get()

Put couple of WARN_ONs in devlink_param_driverinit_value_get() function
to clearly indicate, that it is a driver bug if used without reload
support or for non-driverinit param.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 85fe0b32
...@@ -10898,16 +10898,18 @@ int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id, ...@@ -10898,16 +10898,18 @@ int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
{ {
struct devlink_param_item *param_item; struct devlink_param_item *param_item;
if (!devlink_reload_supported(devlink->ops)) if (WARN_ON(!devlink_reload_supported(devlink->ops)))
return -EOPNOTSUPP; return -EOPNOTSUPP;
param_item = devlink_param_find_by_id(&devlink->param_list, param_id); param_item = devlink_param_find_by_id(&devlink->param_list, param_id);
if (!param_item) if (!param_item)
return -EINVAL; return -EINVAL;
if (!param_item->driverinit_value_valid || if (!param_item->driverinit_value_valid)
!devlink_param_cmode_is_supported(param_item->param, return -EOPNOTSUPP;
DEVLINK_PARAM_CMODE_DRIVERINIT))
if (WARN_ON(!devlink_param_cmode_is_supported(param_item->param,
DEVLINK_PARAM_CMODE_DRIVERINIT)))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING) if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment