mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regmap: fix compilation warning
@ 2015-09-02 11:08 Mike Rapoport
  2015-09-14 17:41 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Rapoport @ 2015-09-02 11:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Greg Kroah-Hartman, LKML, Mike Rapoport

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@gmail.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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] regmap: fix compilation warning
  2015-09-02 11:08 [PATCH] regmap: fix compilation warning Mike Rapoport
@ 2015-09-14 17:41 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-09-14 17:41 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Greg Kroah-Hartman, LKML

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

On Wed, Sep 02, 2015 at 02:08:07PM +0300, Mike Rapoport wrote:
> Explicitly initialize ret to -EINVAL in regmap_raw_read to fix the
> following compilation warning:

This doesn't seem to apply any more, can you please check and resend if
it's still needed (there were some changes went in near the merge window
it collided with).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-14 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-02 11:08 [PATCH] regmap: fix compilation warning Mike Rapoport
2015-09-14 17:41 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®