bma180: add argc check

This commit is contained in:
Beat Küng
2018-06-04 14:28:52 +02:00
committed by Lorenz Meier
parent 7a3b34be74
commit 8f5fb3d0e5
+5 -1
View File
@@ -890,9 +890,12 @@ info()
int
bma180_main(int argc, char *argv[])
{
if (argc < 2) {
goto out_error;
}
/*
* Start/load the driver.
*/
if (!strcmp(argv[1], "start")) {
bma180::start();
@@ -919,5 +922,6 @@ bma180_main(int argc, char *argv[])
bma180::info();
}
out_error:
errx(1, "unrecognised command, try 'start', 'test', 'reset' or 'info'");
}