testing/sensor: fix bug about -h
MIRTOS-334 Change-Id: I1803ad1c769189f42d223111c7eb898e091eeccc Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
d838666844
commit
993693d5f4
@ -224,8 +224,7 @@ int main(int argc, FAR char *argv[])
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
optind = 0;
|
||||
return 0;
|
||||
goto name_err;
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,18 +246,21 @@ int main(int argc, FAR char *argv[])
|
||||
{
|
||||
printf("The sensor node name:%s is invaild\n", name);
|
||||
usage();
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto name_err;
|
||||
}
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto name_err;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usage();
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto name_err;
|
||||
}
|
||||
|
||||
snprintf(devname, PATH_MAX, DEVNAME_FMT, name);
|
||||
@ -341,5 +343,7 @@ ctl_err:
|
||||
close(fd);
|
||||
open_err:
|
||||
free(buffer);
|
||||
name_err:
|
||||
optind = 0;
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user