Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396054

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

From Matias Bjørling <m@bjorling.me>
Newsgroups linux.kernel
Subject [PATCH 01/28] lightnvm: fix "warning: ‘ret’ may be used uninitialized"
Date 2016-05-06 20:20 +0200
Message-ID <rvSw3-1EJ-37@gated-at.bofh.it> (permalink)
References <rvSml-1A4-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jeff Mahoney <jeffm@suse.com>

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@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/28] LightNVM fixes for 4.7 Matias Bjørling <m@bjorling.me> - 2016-05-06 20:10 +0200
  [PATCH 04/28] lightnvm: add fpg_size and pfpg_size to struct nvm_dev Matias Bjørling <m@bjorling.me> - 2016-05-06 20:10 +0200
  [PATCH 11/28] lightnvm: introduce nvm_for_each_lun_ppa() macro Matias Bjørling <m@bjorling.me> - 2016-05-06 20:10 +0200
  [PATCH 05/28] lightnvm: move block fold outside of get_bb_tbl() Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 10/28] lightnvm: refactor dev->online_target to global nvm_targets Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 13/28] lightnvm: remove struct factory_blks Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 07/28] lightnvm: calculate rrpc total blocks and sectors up front Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 09/28] lightnvm: rename nvm_targets to nvm_tgt_type Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 06/28] lightnvm: avoid memory leak when lun_map kcalloc fails Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 02/28] lightnvm: handle submit_io failure Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 12/28] lightnvm: refactor device ops->get_bb_tbl() Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 03/28] lightnvm: implement nvm_submit_ppa_list Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 14/28] lightnvm: make nvm_set_rqd_ppalist() aware of vblks Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 01/28] lightnvm: fix "warning: ‘ret’ may be used uninitialized" Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  Re: [PATCH 00/28] LightNVM fixes for 4.7 Jens Axboe <axboe@fb.com> - 2016-05-10 16:50 +0200

csiph-web