From 7e2b694c1d68813cf1ebd2703d4f0e88267c76bb Mon Sep 17 00:00:00 2001 From: Zhanglong Xia Date: Thu, 23 Dec 2021 14:49:52 +0800 Subject: [PATCH] [posix] remove GPIO line offset check (#7238) The `GPIOHANDLES_MAX` represents the maximum number of requested handles. It should not be used to check the GPIO line offset. --- src/posix/platform/spi_interface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/posix/platform/spi_interface.cpp b/src/posix/platform/spi_interface.cpp index 77d3b6109..ec9f203f7 100644 --- a/src/posix/platform/spi_interface.cpp +++ b/src/posix/platform/spi_interface.cpp @@ -285,7 +285,7 @@ void SpiInterface::InitResetPin(const char *aCharDev, uint8_t aLine) otLogDebgPlat("InitResetPin: charDev=%s, line=%" PRIu8, aCharDev, aLine); - VerifyOrDie((aCharDev != nullptr) && (aLine < GPIOHANDLES_MAX), OT_EXIT_INVALID_ARGUMENTS); + VerifyOrDie(aCharDev != nullptr, OT_EXIT_INVALID_ARGUMENTS); VerifyOrDie((fd = open(aCharDev, O_RDWR)) != -1, OT_EXIT_ERROR_ERRNO); mResetGpioValueFd = SetupGpioHandle(fd, aLine, GPIOHANDLE_REQUEST_OUTPUT, label); @@ -299,7 +299,7 @@ void SpiInterface::InitIntPin(const char *aCharDev, uint8_t aLine) otLogDebgPlat("InitIntPin: charDev=%s, line=%" PRIu8, aCharDev, aLine); - VerifyOrDie((aCharDev != nullptr) && (aLine < GPIOHANDLES_MAX), OT_EXIT_INVALID_ARGUMENTS); + VerifyOrDie(aCharDev != nullptr, OT_EXIT_INVALID_ARGUMENTS); VerifyOrDie((fd = open(aCharDev, O_RDWR)) != -1, OT_EXIT_ERROR_ERRNO); mIntGpioValueFd = SetupGpioEvent(fd, aLine, GPIOHANDLE_REQUEST_INPUT, GPIOEVENT_REQUEST_FALLING_EDGE, label);