[PATCH 01/28] lightnvm: fix "warning: âretâ may be used uninitialized"

From: Matias BjÃrling
Date: Fri May 06 2016 - 14:13:02 EST


From: Jeff Mahoney <jeffm@xxxxxxxx>

This fixes the following warnings:
drivers/lightnvm/sysblk.c:125:9: warning: âretâ may be used
uninitialized in this function

drivers/lightnvm/sysblk.c:275:15: warning: âretâ may be used
uninitialized in this function

In both cases, ret is only set from within a loop that may not be entered.

Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>
Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
Signed-off-by: Matias BjÃrling <m@xxxxxxxxxxx>
---
drivers/lightnvm/sysblk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/lightnvm/sysblk.c b/drivers/lightnvm/sysblk.c
index 321de1f..b1e1404 100644
--- a/drivers/lightnvm/sysblk.c
+++ b/drivers/lightnvm/sysblk.c
@@ -122,7 +122,7 @@ static int nvm_get_all_sysblks(struct nvm_dev *dev, struct sysblk_scan *s,
struct ppa_addr *ppas, nvm_bb_update_fn *fn)
{
struct ppa_addr dppa;
- int i, ret;
+ int i, ret = 0;

s->nr_ppas = 0;

@@ -272,7 +272,7 @@ static int nvm_write_and_verify(struct nvm_dev *dev, struct nvm_sb_info *info,
{
struct nvm_system_block nvmsb;
void *buf;
- int i, sect, ret, bufsz;
+ int i, sect, ret = 0, bufsz;
struct ppa_addr *ppas;

nvm_cpu_to_sysblk(&nvmsb, info);
--
2.1.4