lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  2 Sep 2015 14:08:07 +0300
From:	Mike Rapoport <mike.rapoport@...il.com>
To:	Mark Brown <broonie@...nel.org>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Mike Rapoport <mike.rapoport@...il.com>
Subject: [PATCH] regmap: fix compilation warning

Explicitly initialize ret to -EINVAL in regmap_raw_read to fix the
following compilation warning:

  CC      drivers/base/regmap/regmap.o
linux/drivers/base/regmap/regmap.c: In function ‘regmap_raw_read’:
linux/drivers/base/regmap/regmap.c:2174:6: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int ret, i;
      ^

Signed-off-by: Mike Rapoport <mike.rapoport@...il.com>
---
 drivers/base/regmap/regmap.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 7111d04..ba0aab4 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2171,14 +2171,15 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 	size_t val_bytes = map->format.val_bytes;
 	size_t val_count = val_len / val_bytes;
 	unsigned int v;
-	int ret, i;
+	int i;
+	int ret = -EINVAL;
 
 	if (!map->bus)
-		return -EINVAL;
+		return ret;
 	if (val_len % map->format.val_bytes)
-		return -EINVAL;
+		return ret;
 	if (reg % map->reg_stride)
-		return -EINVAL;
+		return ret;
 
 	map->lock(map->lock_arg);
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ