Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dev/dax: fix uninitialized variable build warning
@ 2017-10-18 15:40 Ross Zwisler
  2017-10-18 15:40 ` [PATCH 2/2] MAINTAINERS: Add entry for device DAX Ross Zwisler
  2017-10-18 15:56 ` [PATCH 1/2] dev/dax: fix uninitialized variable build warning Dan Williams
  0 siblings, 2 replies; 6+ messages in thread
From: Ross Zwisler @ 2017-10-18 15:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-nvdimm

Fix this build warning:

warning: 'phys' may be used uninitialized in this function
[-Wuninitialized]

As reported here:

https://lkml.org/lkml/2017/10/16/152

This should have no functional change because you can only get into the if
statement in dax_pgoff_to_phys() that is complaining about 'phys' being
uninitialized if you broke out early in the above loop, in which case
'phys' will be set.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 drivers/dax/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index e9f3b3e..4aca0a2 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -222,7 +222,7 @@ __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff,
 		unsigned long size)
 {
 	struct resource *res;
-	phys_addr_t phys;
+	phys_addr_t phys = 0;
 	int i;
 
 	for (i = 0; i < dev_dax->num_resources; i++) {
-- 
2.9.5

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2017-10-20  0:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-18 15:40 [PATCH 1/2] dev/dax: fix uninitialized variable build warning Ross Zwisler
2017-10-18 15:40 ` [PATCH 2/2] MAINTAINERS: Add entry for device DAX Ross Zwisler
2017-10-18 16:12   ` Dan Williams
2017-10-18 15:56 ` [PATCH 1/2] dev/dax: fix uninitialized variable build warning Dan Williams
2017-10-18 18:21   ` [PATCH v2] " Ross Zwisler
2017-10-20  0:09     ` Dan Williams

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