Patchwork [iproute] devlink: Fix error reporting in cmd_resource_set()

login
register
mail settings
Submitter Phil Sutter
Date Oct. 18, 2018, 11:28 a.m.
Message ID <20181018112823.5220-1-phil@nwl.cc>
Download mbox | patch
Permalink /patch/638725/
State New
Headers show

Comments

Phil Sutter - Oct. 18, 2018, 11:28 a.m.
resource_path_parse() returns either zero or a negative error code,
hence the negated value must be passed to strerror().

Fixes: 8cd644095842a ("devlink: Add support for devlink resource abstraction")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 devlink/devlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Jiri Pirko - Oct. 18, 2018, 12:56 p.m.
Thu, Oct 18, 2018 at 01:28:23PM CEST, phil@nwl.cc wrote:
>resource_path_parse() returns either zero or a negative error code,
>hence the negated value must be passed to strerror().
>
>Fixes: 8cd644095842a ("devlink: Add support for devlink resource abstraction")
>Signed-off-by: Phil Sutter <phil@nwl.cc>

Acked-by: Jiri Pirko <jiri@mellanox.com>

Patch

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 519ee2577cc4c..8bb254ea1b0b8 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -5127,7 +5127,7 @@  static int cmd_resource_set(struct dl *dl)
 				  &dl->opts.resource_id,
 				  &dl->opts.resource_id_valid);
 	if (err) {
-		pr_err("error parsing resource path %s\n", strerror(err));
+		pr_err("error parsing resource path %s\n", strerror(-err));
 		goto out;
 	}