mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: map: Fix compilation warning
@ 2012-10-29 17:17 Viresh Kumar
  2012-11-07  8:36 ` Viresh Kumar
  2012-11-15 11:31 ` Artem Bityutskiy
  0 siblings, 2 replies; 3+ messages in thread
From: Viresh Kumar @ 2012-10-29 17:17 UTC (permalink / raw)
  To: dwmw2
  Cc: linaro-dev, patches, linux-mtd, linux-kernel, dedekind1, Viresh Kumar

This patch is an attempt to fix following compilation warning.

In file included from drivers/mtd/chips/cfi_cmdset_0001.c:35:0:
drivers/mtd/chips/cfi_cmdset_0001.c: In function 'cfi_intelext_write_words':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]

I could have used uninitialized_var() too, but didn't used it as the final else
part of map_word_load() is missing. So there is a chance that it might be passed
uninitialized. Better initialize to zero.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 include/linux/mtd/map.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 3595a02..56c7936 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -328,7 +328,7 @@ static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word
 
 static inline map_word map_word_load(struct map_info *map, const void *ptr)
 {
-	map_word r;
+	map_word r = {{0} };
 
 	if (map_bankwidth_is_1(map))
 		r.x[0] = *(unsigned char *)ptr;
-- 
1.7.12.rc2.18.g61b472e


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

* Re: [PATCH] mtd: map: Fix compilation warning
  2012-10-29 17:17 [PATCH] mtd: map: Fix compilation warning Viresh Kumar
@ 2012-11-07  8:36 ` Viresh Kumar
  2012-11-15 11:31 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2012-11-07  8:36 UTC (permalink / raw)
  To: dwmw2
  Cc: linaro-dev, patches, linux-mtd, linux-kernel, dedekind1, Viresh Kumar

On 29 October 2012 22:47, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> This patch is an attempt to fix following compilation warning.
>
> In file included from drivers/mtd/chips/cfi_cmdset_0001.c:35:0:
> drivers/mtd/chips/cfi_cmdset_0001.c: In function 'cfi_intelext_write_words':
> include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> I could have used uninitialized_var() too, but didn't used it as the final else
> part of map_word_load() is missing. So there is a chance that it might be passed
> uninitialized. Better initialize to zero.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Ping!!

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

* Re: [PATCH] mtd: map: Fix compilation warning
  2012-10-29 17:17 [PATCH] mtd: map: Fix compilation warning Viresh Kumar
  2012-11-07  8:36 ` Viresh Kumar
@ 2012-11-15 11:31 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2012-11-15 11:31 UTC (permalink / raw)
  To: Viresh Kumar; +Cc: dwmw2, linaro-dev, patches, linux-mtd, linux-kernel

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

On Mon, 2012-10-29 at 22:47 +0530, Viresh Kumar wrote:
> This patch is an attempt to fix following compilation warning.
> 
> In file included from drivers/mtd/chips/cfi_cmdset_0001.c:35:0:
> drivers/mtd/chips/cfi_cmdset_0001.c: In function 'cfi_intelext_write_words':
> include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> I could have used uninitialized_var() too, but didn't used it as the final else
> part of map_word_load() is missing. So there is a chance that it might be passed
> uninitialized. Better initialize to zero.

Pushed to l2-mtd.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-11-15 11:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-29 17:17 [PATCH] mtd: map: Fix compilation warning Viresh Kumar
2012-11-07  8:36 ` Viresh Kumar
2012-11-15 11:31 ` Artem Bityutskiy

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

Powered by JetHome