This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 6d9792ec9ef6bb58d715ef1ec39bcacdb1f9a72c
Author: Magdalena Kasenberg <magdalena.kasenb...@codecoup.pl>
AuthorDate: Thu Feb 25 15:58:22 2021 +0100

    sensors/tsl2561: Fix logically dead code
    
    Fix missing condition.
    Coverity issue 206481.
---
 hw/drivers/sensors/tsl2561/src/tsl2561_shell.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/drivers/sensors/tsl2561/src/tsl2561_shell.c 
b/hw/drivers/sensors/tsl2561/src/tsl2561_shell.c
index 0742898..c9bbf30 100644
--- a/hw/drivers/sensors/tsl2561/src/tsl2561_shell.c
+++ b/hw/drivers/sensors/tsl2561/src/tsl2561_shell.c
@@ -159,11 +159,11 @@ tsl2561_shell_cmd_gain(int argc, char **argv)
     /* Update the gain */
     if (argc == 3) {
         val = parse_ll_bounds(argv[2], 1, 16, &rc);
-        /* Make sure gain is 1 ot 16 */
+        /* Make sure gain is 1 or 16 */
         if (rc || ((val != 1) && (val != 16))) {
             return tsl2561_shell_err_invalid_arg(argv[2]);
         }
-        rc = tsl2561_set_gain(&g_sensor_itf, val ?
+        rc = tsl2561_set_gain(&g_sensor_itf, val == 16 ?
                               TSL2561_LIGHT_GAIN_16X : TSL2561_LIGHT_GAIN_1X);
         if (rc) {
             console_printf("Setting gain failed rc:%d", rc);

Reply via email to