diff mbox series

[oe,meta-oe,1/3] upm: Fix 'may be used uninitialized' errors

Message ID 20191225165709.2123137-1-raj.khem@gmail.com
State Accepted
Commit 25b0cbe98f294e98732ff546b8a7f4b1b2da4c6c
Headers show
Series [oe,meta-oe,1/3] upm: Fix 'may be used uninitialized' errors | expand

Commit Message

Khem Raj Dec. 25, 2019, 4:57 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 ...nitialize-local-variables-before-use.patch | 57 +++++++++++++++++++
 meta-oe/recipes-extended/upm/upm_git.bb       |  1 +
 2 files changed, 58 insertions(+)
 create mode 100644 meta-oe/recipes-extended/upm/upm/0001-initialize-local-variables-before-use.patch

-- 
2.24.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/upm/upm/0001-initialize-local-variables-before-use.patch b/meta-oe/recipes-extended/upm/upm/0001-initialize-local-variables-before-use.patch
new file mode 100644
index 0000000000..f9fae1641d
--- /dev/null
+++ b/meta-oe/recipes-extended/upm/upm/0001-initialize-local-variables-before-use.patch
@@ -0,0 +1,57 @@ 
+From cce8be3966b602cf7e20d559e50fcf493b9b42cc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 23 Dec 2019 18:13:21 -0800
+Subject: [PATCH] initialize local variables before use
+
+fixes
+error: 'ctrl_reg2_data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+Upstream-Status: Submitted [https://github.com/eclipse/upm/pull/693]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/kxtj3/kxtj3.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/kxtj3/kxtj3.c b/src/kxtj3/kxtj3.c
+index a6f3c4f8..050ae585 100755
+--- a/src/kxtj3/kxtj3.c
++++ b/src/kxtj3/kxtj3.c
+@@ -715,7 +715,7 @@ upm_result_t kxtj3_sensor_software_reset(const kxtj3_context dev)
+     if (kxtj3_set_bit_on(dev, KXTJ3_CTRL_REG2, KXTJ3_CTRL_REG2_SRST) != UPM_SUCCESS)
+         return UPM_ERROR_OPERATION_FAILED;
+ 
+-    uint8_t ctrl_reg2_data;
++    uint8_t ctrl_reg2_data = 0;
+     kxtj3_read_register(dev, KXTJ3_CTRL_REG2, &ctrl_reg2_data);
+ 
+     uint8_t srst_counter = 0;
+@@ -824,7 +824,7 @@ upm_result_t kxtj3_enable_interrupt_pin(const kxtj3_context dev, KXTJ3_INTERRUPT
+                                         KXTJ3_INTERRUPT_RESPONSE_T response_type)
+ {
+     assert(dev != NULL);
+-    uint8_t int_reg_value;
++    uint8_t int_reg_value = 0;
+     kxtj3_read_register(dev, KXTJ3_INT_CTRL_REG1, &int_reg_value);
+ 
+     if (polarity)
+@@ -865,7 +865,7 @@ upm_result_t kxtj3_set_interrupt_response(const kxtj3_context dev, KXTJ3_INTERRU
+ bool kxtj3_get_interrupt_status(const kxtj3_context dev)
+ {
+     assert(dev != NULL);
+-    uint8_t status_reg_value;
++    uint8_t status_reg_value = 0;
+     kxtj3_read_register(dev, KXTJ3_STATUS_REG, &status_reg_value);
+     if (!(status_reg_value & KXTJ3_STATUS_REG_INT))
+         return false;
+@@ -955,7 +955,7 @@ kxtj3_wakeup_axes kxtj3_get_wakeup_axis_and_direction(kxtj3_context dev)
+ {
+     assert(dev != NULL);
+ 
+-    uint8_t int_source2_value;
++    uint8_t int_source2_value = 0;
+     kxtj3_read_register(dev, KXTJ3_INT_SOURCE2, &int_source2_value);
+ 
+     kxtj3_wakeup_axes wakeup_axis;
+-- 
+2.24.1
+
diff --git a/meta-oe/recipes-extended/upm/upm_git.bb b/meta-oe/recipes-extended/upm/upm_git.bb
index dbe97370d5..7564738dda 100644
--- a/meta-oe/recipes-extended/upm/upm_git.bb
+++ b/meta-oe/recipes-extended/upm/upm_git.bb
@@ -13,6 +13,7 @@  PV = "2.0.0+git${SRCPV}"
 SRC_URI = "git://github.com/intel-iot-devkit/${BPN}.git;protocol=http \
            file://0001-CMakeLists.txt-Use-SWIG_SUPPORT_FILES-to-find-the-li.patch \
            file://0001-Use-stdint-types.patch \
+           file://0001-initialize-local-variables-before-use.patch \
            "
 
 SRC_URI_append_toolchain-clang_x86 = " file://0001-nmea_gps-Link-with-latomic.patch "