Skip to content

Commit

Permalink
imx9/version/board_mcu_version.c: Check pointer arguments to board_mc…
Browse files Browse the repository at this point in the history
…u_version

It is legal to pass null pointers for those arguments which the caller is not interested of

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Sep 1, 2024
1 parent 6e6f3b1 commit 106932b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions platforms/nuttx/src/px4/nxp/imx9/version/board_mcu_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,17 @@ int board_mcu_version(char *rev, const char **revstr, const char **errata)
unsigned len = sizeof(hw_version_table) / sizeof(hw_version_table[0]);

if (hw_version < len) {
*rev = hw_version_table[hw_version].rev;
*revstr = hw_version_table[hw_version].revstr;
*errata = hw_version_table[hw_version].errata;
if (rev) {
*rev = hw_version_table[hw_version].rev;
}

if (revstr) {
*revstr = hw_version_table[hw_version].revstr;
}

if (errata) {
*errata = hw_version_table[hw_version].errata;
}
}

return hw_version;
Expand Down

0 comments on commit 106932b

Please sign in to comment.