On 11/23/17 5:25 AM, Arkadi Sharshevsky wrote: > [...] >>>>> + >>>>> + 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. >
EINVAL is returned in multiple places, so an EINVAL response does not uniquely tell you the problem. Further, we have infrastructure to give users explicit text on why the request fails. Let's use it and make Linux more user friendly.