Message ID | 20170716142919.3485-1-lokeshvutla@ti.com |
---|---|
State | Accepted |
Commit | 7087922477a08bd1c06bcb5a280ff5e81065ec30 |
Delegated to: | Tom Rini |
Headers | show |
On Sun, Jul 16, 2017 at 07:59:18PM +0530, Lokesh Vutla wrote: > board_is*("rev", board_ti_get_rev()) uses strncmp() for > revison detection and assumes it is success if return value > is <= 0. This will fail in case of multiple versions, as > revb will be true for board_is_*revb() and board_is_*reva(). > Fix it by looking for exact match of the string. > > Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
On Sun, Jul 16, 2017 at 07:59:18PM +0530, Lokesh Vutla wrote: > board_is*("rev", board_ti_get_rev()) uses strncmp() for > revison detection and assumes it is success if return value > is <= 0. This will fail in case of multiple versions, as > revb will be true for board_is_*revb() and board_is_*reva(). > Fix it by looking for exact match of the string. > > Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> > Reviewed-by: Tom Rini <trini@konsulko.com> Applied to u-boot/master, thanks!
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index bf8c8e1a67..6e248d6b1a 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -36,11 +36,11 @@ #define board_is_x15() board_ti_is("BBRDX15_") #define board_is_x15_revb1() (board_ti_is("BBRDX15_") && \ - (strncmp("B.10", board_ti_get_rev(), 3) <= 0)) + !strncmp("B.10", board_ti_get_rev(), 3)) #define board_is_am572x_evm() board_ti_is("AM572PM_") #define board_is_am572x_evm_reva3() \ (board_ti_is("AM572PM_") && \ - (strncmp("A.30", board_ti_get_rev(), 3) <= 0)) + !strncmp("A.30", board_ti_get_rev(), 3)) #define board_is_am572x_idk() board_ti_is("AM572IDK") #define board_is_am571x_idk() board_ti_is("AM571IDK")
board_is*("rev", board_ti_get_rev()) uses strncmp() for revison detection and assumes it is success if return value is <= 0. This will fail in case of multiple versions, as revb will be true for board_is_*revb() and board_is_*reva(). Fix it by looking for exact match of the string. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> --- board/ti/am57xx/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)