[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210301105654.291949-5-parav@nvidia.com>
Date: Mon, 1 Mar 2021 12:56:54 +0200
From: Parav Pandit <parav@...dia.com>
To: <dsahern@...il.com>, <stephen@...workplumber.org>,
<netdev@...r.kernel.org>
CC: Parav Pandit <parav@...dia.com>
Subject: [PATCH iproute2-next 4/4] 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@...dia.com>
---
devlink/devlink.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index eaac1806..16eca4f9 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -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;
}
--
2.26.2
Powered by blists - more mailing lists