Skip to contentSkip to conversation

nvmem: core: don't check the return value of notifier chain call

PATCH In review Bartosz Golaszewski 2 participants 2 messages Feb 15, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: core: don't check the return value of notifier chain call

From: Bartosz Golaszewski <[email protected]>

blocking_notifier_call_chain() returns the value returned by the last registered callback. A positive return value doesn't indicate an error and an nvmem device should correctly register irrespective of any notifier callback failures. Drop the retval check.

Fixes bee1138bea15 ("nvmem: add a notifier chain")
---
 drivers/nvmem/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/nvmem/core.c +1 -3
index f7301bb4ef3b..3ce65927e11c 100644
@@ -686,9 +686,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 	if (rval)
 		goto err_remove_cells;
 
-	rval = blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem);
-	if (rval)
-		goto err_remove_cells;
+	blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem);
 
 	return nvmem;
 
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

blocking_notifier_call_chain() returns the value returned by the last registered callback. A positive return value doesn't indicate an error and an nvmem device should correctly register irrespective of any notifier callback failures. Drop the retval check.

Fixes bee1138bea15 ("nvmem: add a notifier chain")

Thanks for the fix!

Quoted 20 lines
---
  drivers/nvmem/core.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/nvmem/core.c +1 -3
index f7301bb4ef3b..3ce65927e11c 100644
@@ -686,9 +686,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
  	if (rval)
  		goto err_remove_cells;
 
-	rval = blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem);
-	if (rval)
-		goto err_remove_cells;
+	blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem);
 
  	return nvmem;