* [PATCH] regmap: Add missing initialization of this_page
@ 2014-04-22 10:47 Geert Uytterhoeven
2014-05-01 3:49 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2014-04-22 10:47 UTC (permalink / raw)
To: Mark Brown, Greg Kroah-Hartman, Opensource [Anthony Olech]
Cc: linux-kernel, Geert Uytterhoeven
drivers/base/regmap/regmap.c: In function ‘_regmap_range_multi_paged_reg_write’:
drivers/base/regmap/regmap.c:1665: warning: ‘this_page’ may be used uninitialized in this function
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
This may be a false positive, if "range" is guaranteed to be non-zero
during the first iteration of the loop
---
drivers/base/regmap/regmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 63e30ef096e2..0eaf581b2bb6 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1662,7 +1662,7 @@ static int _regmap_range_multi_paged_reg_write(struct regmap *map,
int ret;
int i, n;
struct reg_default *base;
- unsigned int this_page;
+ unsigned int this_page = 0;
/*
* the set of registers are not neccessarily in order, but
* since the order of write must be preserved this algorithm
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] regmap: Add missing initialization of this_page
2014-04-22 10:47 [PATCH] regmap: Add missing initialization of this_page Geert Uytterhoeven
@ 2014-05-01 3:49 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-05-01 3:49 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Greg Kroah-Hartman, Opensource [Anthony Olech], linux-kernel
[-- Attachment #1: Type: text/plain, Size: 733 bytes --]
On Tue, Apr 22, 2014 at 12:47:29PM +0200, Geert Uytterhoeven wrote:
> drivers/base/regmap/regmap.c: In function ‘_regmap_range_multi_paged_reg_write’:
> drivers/base/regmap/regmap.c:1665: warning: ‘this_page’ may be used uninitialized in this function
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> This may be a false positive, if "range" is guaranteed to be non-zero
> during the first iteration of the loop
Applied, though with this sort of thing it's generally a bit better to
do the init at the start of the loop rather than at declaration - init
at declaration is a common pattern for just shutting up warnings as
opposed to analyisng to make sure that there's really not an issue.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-01 3:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-22 10:47 [PATCH] regmap: Add missing initialization of this_page Geert Uytterhoeven
2014-05-01 3:49 ` 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®