From 6a07a3a981281faafb2ff391473f43c7030fd3f8 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Thu, 21 Apr 2022 09:45:10 +0900 Subject: [PATCH] AP_IOMCU: convert_pin_number leaves input untouched on failure --- libraries/AP_IOMCU/AP_IOMCU.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libraries/AP_IOMCU/AP_IOMCU.cpp b/libraries/AP_IOMCU/AP_IOMCU.cpp index 8cfca628e3..786fbe6fde 100644 --- a/libraries/AP_IOMCU/AP_IOMCU.cpp +++ b/libraries/AP_IOMCU/AP_IOMCU.cpp @@ -1073,13 +1073,10 @@ bool AP_IOMCU::valid_GPIO_pin(uint8_t pin) const // convert external pin numbers 101 to 108 to internal 0 to 7 bool AP_IOMCU::convert_pin_number(uint8_t& pin) const { - if (pin < 101) { + if (pin < 101 || pin > 108) { return false; } pin -= 101; - if (pin > 7) { - return false; - } return true; }