lightnvm: Fix error handling
diff mbox

Message ID 20170219140928.12968-1-christophe.jaillet@wanadoo.fr
State New
Headers show

Commit Message

Christophe JAILLET Feb. 19, 2017, 2:09 p.m. UTC
According to error handling in this function, it is likely that going to
'out' was expected here.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/lightnvm/rrpc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Matias Bjørling Feb. 20, 2017, 11:13 a.m. UTC | #1
On 02/19/2017 03:09 PM, Christophe JAILLET wrote:
> According to error handling in this function, it is likely that going to
> 'out' was expected here.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/lightnvm/rrpc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
> index e00b1d7b976f..e68efbcf1188 100644
> --- a/drivers/lightnvm/rrpc.c
> +++ b/drivers/lightnvm/rrpc.c
> @@ -1275,8 +1275,10 @@ static int rrpc_bb_discovery(struct nvm_tgt_dev *dev, struct rrpc_lun *rlun)
>  	}
>
>  	nr_blks = nvm_bb_tbl_fold(dev->parent, blks, nr_blks);
> -	if (nr_blks < 0)
> -		return nr_blks;
> +	if (nr_blks < 0) {
> +		ret = nr_blks;
> +		goto out;
> +	}
>
>  	for (i = 0; i < nr_blks; i++) {
>  		if (blks[i] == NVM_BLK_T_FREE)
>

Thanks Christophe. Applied for 4.12.

Patch
diff mbox

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index e00b1d7b976f..e68efbcf1188 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -1275,8 +1275,10 @@  static int rrpc_bb_discovery(struct nvm_tgt_dev *dev, struct rrpc_lun *rlun)
 	}
 
 	nr_blks = nvm_bb_tbl_fold(dev->parent, blks, nr_blks);
-	if (nr_blks < 0)
-		return nr_blks;
+	if (nr_blks < 0) {
+		ret = nr_blks;
+		goto out;
+	}
 
 	for (i = 0; i < nr_blks; i++) {
 		if (blks[i] == NVM_BLK_T_FREE)