[...] >>>> + >>>> + resource = devlink_resource_find(devlink, NULL, resource_id); >>>> + if (!resource) >>>> + return -EINVAL; >>>> + >>>> + if (!resource->resource_ops->size_validate) >>>> + return -EINVAL; >>> >>> genl_info has extack; please add user messages for the above failures. >>> >> >> Isn't EOPNOTSUPP enough ? > > No, I mean every failure above returns EINVAL. Add an extack message > telling the user what is wrong. e.g, > > resource = devlink_resource_find(devlink, NULL, resource_id); > if (!resource) { > NL_SET_ERR_MSG(extack, "Invalid resource id"); > return -EINVAL; > } > > similarly for the rest. >
I don't understand why actually, extended ack should be used when typical errno is not enough, for example something driver specific like "KVD overlapping is not supported". But here if the user provided id for setting the resource, I think EINVAL is enough if devlink cannot find it.