Skip to contentSkip to conversation

cmd: part: Correct error handling

PATCH In review Anders Dellien 3 participants 3 messages Jun 22, 2021 – Jul 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: part: Correct error handling

As 'part_get_info_by_name' now returns more status codes than just -1 to indicate failure, we need to update the return value check.

---
 cmd/part.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/part.c +1 -1
index 3395c17b89..e0463b5a54 100644
@@ -140,7 +140,7 @@ static int do_part_info(int argc, char *const argv[], enum cmd_part_info param)
 			return 1;
 	} else {
 		part = part_get_info_by_name(desc, argv[2], &info);
-		if (part == -1)
+		if (part < 0)
 			return 1;
 	}
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Anders Dellien

As 'part_get_info_by_name' now returns more status codes than just -1 to indicate failure, we need to update the return value check.

---
  cmd/part.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
cmd/part.c +0 -0
index 3395c17b89..e0463b5a54 100644

cmd/part.c static int do_part_info(int argc, char *const argv[], enum cmd_part_info param) · line 146

Quoted 8 lines
cmd/part.c +1 -1
@@ -140,7 +140,7 @@ static int do_part_info(int argc, char *const argv[], enum cmd_part_info param)
  			return 1;
  	} else {
  		part = part_get_info_by_name(desc, argv[2], &info);
-		if (part == -1)
+		if (part < 0)
  			return 1;
  	}