jacobrosenthal closed pull request #800: adc driver impl: correct incoming arg 
check
URL: https://github.com/apache/mynewt-core/pull/800
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/drivers/adc/src/adc.c b/hw/drivers/adc/src/adc.c
index 5eb344064..14b93f739 100644
--- a/hw/drivers/adc/src/adc.c
+++ b/hw/drivers/adc/src/adc.c
@@ -36,7 +36,7 @@ adc_chan_config(struct adc_dev *dev, uint8_t cnum, void *data)
 {
     assert(dev->ad_funcs.af_configure_channel != NULL);
 
-    if (cnum > dev->ad_chan_count) {
+    if (cnum >= dev->ad_chan_count) {
         return (EINVAL);
     }
 
@@ -57,7 +57,7 @@ adc_chan_read(struct adc_dev *dev, uint8_t cnum, int *result)
 {
     assert(dev->ad_funcs.af_read_channel != NULL);
 
-    if (cnum > dev->ad_chan_count) {
+    if (cnum >= dev->ad_chan_count) {
         return (EINVAL);
     }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to