summaryrefslogtreecommitdiffstats
path: root/hardware.c
diff options
context:
space:
mode:
authorAndrei V. FOMITCHEV <andreix.fomitchev@intel.com>2012-10-19 16:26:33 +0200
committerJin Wei <wei.a.jin@intel.com>2014-04-30 15:49:57 +0800
commitec2ddf56e48bba32aac7665773bdf3324440d77f (patch)
treea6fb2da1a3459f7fd4ed20d173466715dd88a4ca /hardware.c
parent37de84bc96f808601897bcd126b73fc839fd2c20 (diff)
downloadhardware_libhardware-ec2ddf56e48bba32aac7665773bdf3324440d77f.tar.gz
hardware_libhardware-ec2ddf56e48bba32aac7665773bdf3324440d77f.tar.bz2
hardware_libhardware-ec2ddf56e48bba32aac7665773bdf3324440d77f.zip
initialization of defined variables
Because in functions of hardware.c, the variables are not initialized when they are defined, valgrind indicates that these variables are used as uninitialised! So, the purpose of this patch is initialization of varaibles. In the same way, the patch fixes the compilation warning (unused variable). Change-Id: Ibaab89d7b57eb9e3a1f46c3af61705a39be10e16 Signed-off-by: Andrei V. FOMITCHEV <andreix.fomitchev@intel.com> Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Diffstat (limited to 'hardware.c')
-rw-r--r--hardware.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/hardware.c b/hardware.c
index 6713ea0..79d0a2f 100644
--- a/hardware.c
+++ b/hardware.c
@@ -67,9 +67,9 @@ static int load(const char *id,
const char *path,
const struct hw_module_t **pHmi)
{
- int status;
- void *handle;
- struct hw_module_t *hmi;
+ int status = -EINVAL;
+ void *handle = NULL;
+ struct hw_module_t *hmi = NULL;
/*
* load the symbols resolving undefined symbols before
@@ -145,11 +145,12 @@ static int hw_module_exists(char *path, size_t path_len, const char *name,
int hw_get_module_by_class(const char *class_id, const char *inst,
const struct hw_module_t **module)
{
- int i;
- char prop[PATH_MAX];
- char path[PATH_MAX];
- char name[PATH_MAX];
- char prop_name[PATH_MAX];
+ int i = 0;
+ char prop[PATH_MAX] = {0};
+ char path[PATH_MAX] = {0};
+ char name[PATH_MAX] = {0};
+ char prop_name[PATH_MAX] = {0};
+
if (inst)
snprintf(name, PATH_MAX, "%s.%s", class_id, inst);