Skip to content

Commit

Permalink
board_ioctl.c: Fix return values, check incoming parameter
Browse files Browse the repository at this point in the history
- Return value should be negated errno ok OK (not PX4_OK)
- Check that the incoming argument is valid (not NULL)
  • Loading branch information
pussuw committed Sep 2, 2024
1 parent fe7d3b2 commit 802d555
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions platforms/nuttx/src/px4/common/board_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int launch_kernel_builtin(int argc, char **argv)
return builtin->main(argc, argv);
}

return ENOENT;
return -ENOENT;
}

/************************************************************************************
Expand All @@ -144,7 +144,11 @@ static int launch_kernel_builtin(int argc, char **argv)

static int platform_ioctl(unsigned int cmd, unsigned long arg)
{
int ret = PX4_OK;
int ret = OK;

if (arg == 0) {
return -EINVAL;
}

switch (cmd) {
case PLATFORMIOCLAUNCH: {
Expand Down

0 comments on commit 802d555

Please sign in to comment.