Skip to contentSkip to conversation

lightnvm: Avoid validation of default op value

PATCH RESEND In review Heiner Litz 3 participants 3 messages Feb 26, 2018 – Feb 27, 2018 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 lightnvm: Avoid validation of default op value

Fixes 38401d231de65 ("lightnvm: set target over-provision on create ioctl")
---
 drivers/lightnvm/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/lightnvm/core.c +2 -4
index dcc9e621e651..74b53fc1b813 100644
@@ -304,11 +304,9 @@ static int __nvm_config_extended(struct nvm_dev *dev,
 	}
 
 	/* op not set falls into target's default */
-	if (e->op == 0xFFFF)
+	if (e->op == 0xFFFF) {
 		e->op = NVM_TARGET_DEFAULT_OP;
-
-	if (e->op < NVM_TARGET_MIN_OP ||
-	    e->op > NVM_TARGET_MAX_OP) {
+	} else if (e->op < NVM_TARGET_MIN_OP || e->op > NVM_TARGET_MAX_OP) {
 		pr_err("nvm: invalid over provisioning value\n");
 		return -EINVAL;
 	}
Signature · 1 line
2.14.1
#1 lore raw
Quoted 28 lines · Heiner Litz
Fixes 38401d231de65 ("lightnvm: set target over-provision on create ioctl")

---
drivers/lightnvm/core.c | 6 ++----

1 file changed, 2 insertions(+), 4 deletions(-)
drivers/lightnvm/core.c +2 -5
index dcc9e621e651..74b53fc1b813 100644
@@ -304,11 +304,9 @@ static int __nvm_config_extended(struct nvm_dev *dev,
 	}
 
 	/* op not set falls into target's default */
-	if (e->op == 0xFFFF)
+	if (e->op == 0xFFFF) {
 		e->op = NVM_TARGET_DEFAULT_OP;
-
-	if (e->op < NVM_TARGET_MIN_OP ||
-	    e->op > NVM_TARGET_MAX_OP) {
+	} else if (e->op < NVM_TARGET_MIN_OP || e->op > NVM_TARGET_MAX_OP) {
 		pr_err("nvm: invalid over provisioning value\n");
 		return -EINVAL;
 	}
--
Quoted 1 line

2.14.1

Thanks for applying the changes. Looks good to me now.

#2 lore raw
In reply to Heiner Litz
Quoted 16 lines · Heiner Litz
Fixes 38401d231de65 ("lightnvm: set target over-provision on create ioctl")
---
  drivers/lightnvm/core.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/lightnvm/core.c +0 -0
index dcc9e621e651..74b53fc1b813 100644
@@ -304,11 +304,9 @@ static int __nvm_config_extended(struct nvm_dev *dev,
  	}
 
  	/* op not set falls into target's default */

drivers/lightnvm/core.c static int __nvm_config_extended(struct nvm_dev *dev, · line 312

Quoted 10 lines
drivers/lightnvm/core.c +2 -4
-	if (e->op == 0xFFFF)
+	if (e->op == 0xFFFF) {
  		e->op = NVM_TARGET_DEFAULT_OP;
-
-	if (e->op < NVM_TARGET_MIN_OP ||
-	    e->op > NVM_TARGET_MAX_OP) {
+	} else if (e->op < NVM_TARGET_MIN_OP || e->op > NVM_TARGET_MAX_OP) {
  		pr_err("nvm: invalid over provisioning value\n");
  		return -EINVAL;
  	}

Thanks Heiner. Applied.