Skip to contentSkip to conversation

lightnvm: Avoid validation of default op value Avoid validation of default op value, if default value is given. In preparation of using the rsvd field of the extended config for additional paramters while using default op.

PATCH In review Heiner Litz 2 participants 2 messages Feb 26, 2018 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lightnvm: Avoid validation of default op value Avoid validation of default op value, if default value is given. In preparation of using the rsvd field of the extended config for additional paramters while using default op.

Fixes 38401d231de65 ("lightnvm: set target over-provision on create ioctl")
---
 drivers/lightnvm/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/lightnvm/core.c +2 -3
index dcc9e621e651..4e6095e2af06 100644
@@ -304,10 +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 ||
+	} 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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Heiner Litz
Fixes 38401d231de65 ("lightnvm: set target over-provision on create ioctl")

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

1 file changed, 2 insertions(+), 3 deletions(-)
drivers/lightnvm/core.c +0 -0
index dcc9e621e651..4e6095e2af06 100644

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

Quoted 10 lines
drivers/lightnvm/core.c +2 -3
@@ -304,10 +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 ||
+	} else if (e->op < NVM_TARGET_MIN_OP ||
 	    e->op > NVM_TARGET_MAX_OP) {

While you are at it, can you fix this and put it in a single line - not sure why this ended up this way...

Quoted 4 lines
drivers/lightnvm/core.c +0 -1
 		pr_err("nvm: invalid over provisioning value\n");
 		return -EINVAL;
--

2.14.1

Apart from the comment, the patch looks good. However, the description went over to the subject. I guess Matias can fix this when picking it up.