소스 검색

tools: dumpimage: Provide more feedback on error

The dumpimage utility errors out in a number of places without providing
sufficient feedback to allow the user to easily determine what they have
done wrong. Add addtional error messages to make the cause of the failure
more obvious.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Martyn Welch 5 년 전
부모
커밋
57a608e969
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      tools/dumpimage.c

+ 9 - 2
tools/dumpimage.c

@@ -80,6 +80,8 @@ int main(int argc, char **argv)
 		case 'T':
 			params.type = genimg_get_type_id(optarg);
 			if (params.type < 0) {
+				fprintf(stderr, "%s: Invalid type\n",
+					params.cmdname);
 				usage();
 			}
 			break;
@@ -101,8 +103,10 @@ int main(int argc, char **argv)
 		}
 	}
 
-	if (optind >= argc)
+	if (optind >= argc) {
+		fprintf(stderr, "%s: image file missing\n", params.cmdname);
 		usage();
+	}
 
 	/* set tparams as per input type_id */
 	tparams = imagetool_get_type(params.type);
@@ -117,8 +121,11 @@ int main(int argc, char **argv)
 	 * as per image type to be generated/listed
 	 */
 	if (tparams->check_params) {
-		if (tparams->check_params(&params))
+		if (tparams->check_params(&params)) {
+			fprintf(stderr, "%s: Parameter check failed\n",
+				params.cmdname);
 			usage();
+		}
 	}
 
 	if (params.iflag)