devlink: Add error print when unknown values specified

When user specifies either unknown flavour or unknown state during
devlink port commands, return appropriate error message.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
Parav Pandit 2021-03-01 12:56:54 +02:00 committed by David Ahern
parent 62ff25e51b
commit c54e7bd605
1 changed files with 6 additions and 2 deletions

View File

@ -1372,8 +1372,10 @@ static int port_flavour_parse(const char *flavour, uint16_t *value)
int num;
num = str_map_lookup_str(port_flavour_map, flavour);
if (num < 0)
if (num < 0) {
invarg("unknown flavour", flavour);
return num;
}
*value = num;
return 0;
}
@ -1383,8 +1385,10 @@ static int port_fn_state_parse(const char *statestr, uint8_t *state)
int num;
num = str_map_lookup_str(port_fn_state_map, statestr);
if (num < 0)
if (num < 0) {
invarg("unknown state", statestr);
return num;
}
*state = num;
return 0;
}